📈

【Shopify.dev和訳】Admin API/GraphQL reference/Events

2021/10/01に公開

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

Event APIs

イベントデータを取得したり、Webhook を登録したりして、アプリをマーチャントストアと同期させることができます。

このセクションには以下が含まれています

  • BasicEvent - 基本イベントは、記事の作成、注文の履行、商品の追加などのリソースの活動を記録します。
  • CommentEvent - コメントイベントは、ショップのスタッフメンバーによって生成されます。コメントイベントは、ショップのスタッフによって生成されます。スタッフが、注文、注文の下書き、顧客、または転送のタイムラインにコメントを追加すると作成されます。
  • CommentEventAttachment - コメントイベントに関連付けられたファイルの添付ファイルです。
  • CommentEventEmbed - コメントイベントのメイン埋込です。
  • CommentEventSubject - コメントイベントの件名です。
  • DeletionEvent - 削除イベントは、リソース(製品やコレクションなど)の削除を行います。一度削除されると、リソース自体が削除され、もはやアクセスできないため、削除イベントはオリジナルの存在を示す唯一の痕跡となります。
  • DeletionEventSortKeys - DeletionEvent クエリの有効なソートキーのセットです。
  • DeletionEventSubjectType - 削除イベントのサポートされているサブジェクト タイプです。
  • Event - イベントは、記事の作成、注文の履行、または製品の追加などのリソース活動を記録します。
  • EventBridgeWebhookSubscriptionInput - EventBridge Webhook サブスクリプションの入力フィールドを指定します。
  • EventSortKeys - イベント クエリの有効なソートキーのセットです。
  • HasEvents - 互換性のあるホスト上のイベント・レコードへのコネクターです。
  • ResourceAlert - 情報や問題をマーチャントに提示し、マーチャントが取ることのできる 1 つ以上のアクションを提示します。オプションで特定のアイコンを持つことができ、マーチャントはこれを解除することができます。
  • ResourceAlertAction - リソースアラートに関連するアクションです。
  • ShopAlert - Shopify の管理画面に表示される警告メッセージです。
  • ShopAlertAction - ショップアラートに関連するアクションです。
  • WebhookEventBridgeEndpoint - Amazon EventBridge のイベントソースです。
  • WebhookHttpEndpoint - POST リクエストが行われる HTTP エンドポイントです。
  • WebhookPubSubEndpoint- Google Cloud Pub/Sub のイベントソースです。
  • WebhookSubscription - Webhook の購読を表します。そのトピックのイベントが発生すると、Shopify は関連するデータオブジェクトを含む POST リクエストを指定されたエンドポイントに送信します。webhooks システムについて詳しくはこちらをご覧ください。
  • WebhookSubscriptionEndpoint - Webhook が配信されるエンドポイントです。
  • WebhookSubscriptionFormat - Webhook サブスクリプションでサポートされている形式です。
  • WebhookSubscriptionInput - Webhook サブスクリプションの入力フィールドを指定します。
  • WebhookSubscriptionSortKeys - WebhookSubscription クエリの有効なソート キーのセット。
  • WebhookSubscriptionTopic - Webhook サブスクリプションのサポートされるトピックです。
  • eventBridgeWebhookSubscriptionCreate - 新しい Amazon EventBridge Webhook サブスクリプションを作成します。
  • eventBridgeWebhookSubscriptionUpdate - Amazon EventBridge webhook サブスクリプションを更新します。
  • flowTriggerReceive - Shopify Flow でマーチャントが定義したワークフローをトリガーします。詳しくは、Shopify Flow トリガーの作成をご覧ください。
  • webhookSubscriptionCreate - 新しい webhook サブスクリプションを作成します。
  • webhookSubscriptionDelete - Webhook サブスクリプションを削除します。
  • webhookSubscriptionUpdate - Webhook サブスクリプションを更新します。

UNIONS

CommentEventEmbed union

コメントイベントのメイン埋込。

可能な型

WebhookSubscriptionEndpoint union

Webhook が配信されるエンドポイント。

可能な型

OBJECTS

BasicEvent object

基本イベントは、記事の作成、注文の履行、製品の追加など、リソースの活動を記録するものです。

フィールド

appTitle (String)
イベントを作成したアプリの名前。

attributeToAppBoolean!
イベントがアプリによって作成されたかどうか。

attributeToUserBoolean!)
イベントが管理者ユーザーによって引き起こされたかどうか。

createdAt (DateTime!)
イベントが作成された日付と時間。

criticalAlertBoolean!)
イベントがクリティカルであるかどうか。

id (ID!)
グローバルに一意な識別子。

message (FormattedString!)
イベントを説明する人間が読めるテキスト。

Implements

Samples

以下が GraphQL クエリです。

query
# 最初に作成された2つの顧客のイベント情報を取得する
fragment TimelineEvent on BasicEvent {
    appTitle
    attributeToApp
    attributeToUser
    createdAt
    criticalAlert
    id
    message
}
query customers {
  customers(first: 2) {
    edges {
      node {
        events(first: 2) {
          edges {
            node {
              ... TimelineEvent
            }
          }
        }
      }
    }
  }
}

返却されるデータは以下になります。

response
{
  "data": {
    "customers": {
      "edges": [
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "appTitle": "Shopify Web",
                    "attributeToApp": true,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T02:22:51Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982160973846",
                    "message": "Shayne Parmelee added a note to this customer."
                  }
                },
                {
                  "node": {
                    "appTitle": "Shopify Web",
                    "attributeToApp": true,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T02:22:51Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982161006614",
                    "message": "Shayne Parmelee added the email bob.slydell@example.com to this customer."
                  }
                }
              ]
            }
          }
        },
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "appTitle": "Content Generator",
                    "attributeToApp": true,
                    "attributeToUser": false,
                    "createdAt": "2019-06-17T03:09:11Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982170804246",
                    "message": "Content Generator added the email dickstiedemann@rosenbaum.biz to this customer."
                  }
                },
                {
                  "node": {
                    "appTitle": null,
                    "attributeToApp": false,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T03:10:00Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982170837014",
                    "message": "Shayne Parmelee changed this customer's email from dickstiedemann@rosenbaum.biz to kermit.haag@rosenbaum.biz."
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 12,
      "actualQueryCost": 12,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 988,
        "restoreRate": 50
      }
    }
  }
}

以下が GraphQL クエリです。

query
# 最初に作成された2つのオーダーのイベント情報を取得する
fragment TimelineEvent on BasicEvent {
    appTitle
    attributeToApp
    attributeToUser
    createdAt
    criticalAlert
    id
    message
}
query orders {
  orders(first: 2) {
    edges {
      node {
        events(first: 2) {
          edges {
            node {
              ... TimelineEvent
            }
          }
        }
      }
    }
  }
}

以下のデータが返却されます。

response
{
  "data": {
    "orders": {
      "edges": [
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "appTitle": null,
                    "attributeToApp": false,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T02:23:42Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982161170454",
                    "message": "Shayne Parmelee created this order from draft order <a href=\"https://graphql-admin.myshopify.com/admin/draft_orders/132584701974\">#D1</a>."
                  }
                },
                {
                  "node": {
                    "appTitle": null,
                    "attributeToApp": false,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T02:23:42Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982161235990",
                    "message": "Shayne Parmelee manually marked this order as paid."
                  }
                }
              ]
            }
          }
        },
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "appTitle": null,
                    "attributeToApp": false,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T02:31:30Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982162251798",
                    "message": "Shayne Parmelee created this order for Bob Slydell from draft order <a href=\"https://graphql-admin.myshopify.com/admin/draft_orders/132584734742\">#D2</a>."
                  }
                },
                {
                  "node": {
                    "appTitle": null,
                    "attributeToApp": false,
                    "attributeToUser": true,
                    "createdAt": "2019-06-17T02:31:30Z",
                    "criticalAlert": false,
                    "id": "gid://shopify/BasicEvent/14982162350102",
                    "message": "Shayne Parmelee manually marked this order as paid."
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 12,
      "actualQueryCost": 12,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 988,
        "restoreRate": 50
      }
    }
  }
}

CommentEvent object

コメントイベントは、ショップのスタッフによって生成されます。スタッフが注文、下書き注文、顧客、転送のタイムラインにコメントを追加したときに発生します。

フィールド

appTitle (String)
イベントを作成したアプリの名前。

attachments ([CommentEventAttachment!]!)
コメントイベントに関連する添付ファイル。

attributeToApp (Boolean!)
イベントがアプリによって作成されたかどうか。

attributeToUser (Boolean!)
イベントが管理者ユーザーによって引き起こされたかどうか。

canDeleteBoolean!)
コメントイベントが削除できるかどうか。true の場合、コメントイベントは削除できます。

canEditBoolean!)
コメントイベントが編集可能かどうか。true の場合、コメントイベントは編集可能です。

createdAt (DateTime!)
イベントが作成された日付と時間。

criticalAlertBoolean!)
イベントがクリティカルであるかどうか。

edited (Boolean!)
コメントイベントが編集されたかどうか。true の場合、コメントイベントが編集されたことになります。

embed (CommentEventEmbed)
コメントイベントに関連する参照。

id (ID!)
グローバルに一意な識別子。

message (FormattedString!)
イベントを説明する人間が読めるテキスト。

rawMessage (String!)
コメントイベントの生の本文。

subject (CommentEventSubject!)
コメントイベントの件名。

Implements

Samples

query
# `node`フィールドとGraphQLフラグメントを使って、注文に対する特定のコメントイベントを取得する
{
  node(id: "gid://shopify/Order/1248358563862") {
    id
    ... on CommentEvent {
      appTitle
      attributeToApp
      attributeToUser
      canDelete
      canEdit
      createdAt
      criticalAlert
      edited
      id
      message
      rawMessage
    }
  }
}
response
{
  "data": {
    "node": {
      "id": "gid://shopify/Order/1248358563862"
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}
query
# ある顧客の特定のコメントイベントを `node` フィールドと GraphQL フラグメントを使って取得する
{
  node(id: "gid://shopify/Customer/1310260264982") {
    id
    ... on CommentEvent {
      appTitle
      attributeToApp
      attributeToUser
      canDelete
      canEdit
      createdAt
      criticalAlert
      edited
      id
      message
      rawMessage
    }
  }
}
response
{
  "data": {
    "node": {
      "id": "gid://shopify/Customer/1310260264982"
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}
query
# 最初に作成された2つの注文のコメントイベントを取得する
fragment TimelineEvent on Event {
  id
  createdAt
  message
  ... on CommentEvent {
    appTitle
    attributeToApp
    attributeToUser
    canDelete
    canEdit
    createdAt
    criticalAlert
    edited
    id
    message
    rawMessage
  }
}

query orders {
  orders(first: 2) {
    edges {
      node {
        events(first: 2) {
          edges {
            node {
              ...TimelineEvent
            }
          }
        }
      }
    }
  }
}
response
{
  "data": {
    "orders": {
      "edges": [
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982161170454",
                    "createdAt": "2019-06-17T02:23:42Z",
                    "message": "Shayne Parmelee created this order from draft order <a href=\"https://graphql-admin.myshopify.com/admin/draft_orders/132584701974\">#D1</a>."
                  }
                },
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982161235990",
                    "createdAt": "2019-06-17T02:23:42Z",
                    "message": "Shayne Parmelee manually marked this order as paid."
                  }
                }
              ]
            }
          }
        },
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982162251798",
                    "createdAt": "2019-06-17T02:31:30Z",
                    "message": "Shayne Parmelee created this order for Bob Slydell from draft order <a href=\"https://graphql-admin.myshopify.com/admin/draft_orders/132584734742\">#D2</a>."
                  }
                },
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982162350102",
                    "createdAt": "2019-06-17T02:31:30Z",
                    "message": "Shayne Parmelee manually marked this order as paid."
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 12,
      "actualQueryCost": 12,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 988,
        "restoreRate": 50
      }
    }
  }
}
query
# 作成された最初の2つの顧客のコメントイベントを取得する
fragment TimelineEvent on Event {
  id
  createdAt
  message
  ... on CommentEvent {
    appTitle
    attributeToApp
    attributeToUser
    canDelete
    canEdit
    createdAt
    criticalAlert
    edited
    id
    message
    rawMessage
  }
}

query customers {
  customers(first: 2) {
    edges {
      node {
        events(first: 2) {
          edges {
            node {
              ...TimelineEvent
            }
          }
        }
      }
    }
  }
}
response
{
  "data": {
    "customers": {
      "edges": [
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982160973846",
                    "createdAt": "2019-06-17T02:22:51Z",
                    "message": "Shayne Parmelee added a note to this customer."
                  }
                },
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982161006614",
                    "createdAt": "2019-06-17T02:22:51Z",
                    "message": "Shayne Parmelee added the email bob.slydell@example.com to this customer."
                  }
                }
              ]
            }
          }
        },
        {
          "node": {
            "events": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982170804246",
                    "createdAt": "2019-06-17T03:09:11Z",
                    "message": "Content Generator added the email dickstiedemann@rosenbaum.biz to this customer."
                  }
                },
                {
                  "node": {
                    "id": "gid://shopify/BasicEvent/14982170837014",
                    "createdAt": "2019-06-17T03:10:00Z",
                    "message": "Shayne Parmelee changed this customer's email from dickstiedemann@rosenbaum.biz to kermit.haag@rosenbaum.biz."
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 12,
      "actualQueryCost": 12,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 988,
        "restoreRate": 50
      }
    }
  }
}

CommentEventAttachment object

コメントイベントに関連する添付ファイル。

フィールド

fileExtension (String)
コメントイベントの添付ファイルのファイル拡張子で、ファイル形式を示します。

id (ID!)
グローバルに一意な識別子。

image (Image)
コメントイベントに添付された画像。

引数 詳細
crop ( CropRegion ) 指定された領域に従って画像をクロップします。この引数は非推奨です。代わりに Image.transformedSrccrop を使用してください。
maxHeight ( Int ) 画像の高さを 1 から 2048 までのピクセル数で指定します。この引数は非推奨です。代わりにImage.transformedSrcmaxHeightを使用してください。
maxWidth ( Int ) 画像の幅を 1 ~ 2048 の間でピクセル単位で指定します。この引数は非推奨です。代わりにImage.transformedSrcmaxWidthを使用してください。
scale ( Int ) 高解像度の網膜ディスプレイのための画像サイズの乗数。1 から 3 の間でなければなりません。この引数は推奨されません。代わりにImage.transformedSrcscaleを使用してください。デフォルト値:1

name (String!)
コメントイベントの添付ファイルのファイル名です。

size (Int!)
添付ファイルのサイズ。

url (URL!)
添付ファイルの URL。

CommentEventAttachment の返却型

DeletionEvent object

削除イベントは、リソース(製品やコレクションなど)の破壊を記録するものです。一度削除されると、リソース自体が削除されてアクセスできなくなるため、削除イベントがオリジナルの存在を示す唯一の痕跡となります。

フィールド

occurredAt (DateTime!)
関連リソースの削除イベントが発生した日時です。

subjectId (ID!)
削除されたリソースの ID。

subjectType (DeletionEventSubjectType!)
削除されたリソースのタイプ。

DeletionEvent の返却型

ResourceAlert object

マーチャントに情報や問題を提示し、マーチャントが取ることのできる 1 つ以上のアクションを表示します。オプションで、特定のアイコンを持ち、マーチャントから解雇されることもできます。

フィールド

actions ([ResourceAlertAction!]!]!)
関連情報にリンクするアラート内のボタン。例えば、View risk assessment。

content (HTML!)
アラートに関する詳細。

dismissibleHandle (String)
マーチャントがアラートを手動で閉じたときに表示される一意の識別子。ほとんどのアラートは手動で閉じることができません。

icon (ResourceAlertIcon)
アラートとともに表示されるアイコンです。

severityResourceAlertSeverity!)
アラートの重要度を示すもの。

title (String!)
アラートの名前。

ResourceAlert の返却型

ResourceAlertAction object

リソースアラートに関連するアクションです。

フィールド

primary (Boolean!)
アクションがプライマリであるかどうか。

show (String)
表示するアクションのリソース。

title (String!)
アクションのタイトル。

url (URL!)
アクションのターゲット URL。

ResourceAlertAction の返却型

ShopAlert object

Shopify の管理画面に表示されるアラートメッセージです。

フィールド

action (ShopAlertAction!)
関連情報にリンクするアラート内のボタン。

description (String!)
アラートの説明。

ShopAlert の返却型

ShopAlertAction object

Shop アラートに関連するアクションです。

フィールド

title (String!)
アクションのタイトル。

url (URL!)
アクションのターゲット URL。

ShopAlertAction の返却型

WebhookEventBridgeEndpoint object

Amazon EventBridge のイベントソースです。

フィールド

ARN (ARN!)
この EventBridge のイベントソースの ARN。

WebhookHttpEndpoint object

POST リクエストの送信先となる HTTP エンドポイントです。

フィールド

callbackUrl (URL!)
Webhook を配信するための Webhook エンドポイントの URL です。

WebhookPubSubEndpoint object

Google Cloud の Pub/Sub のイベントソースです。

フィールド

pubSubProject (String!)
Google Cloud Pub/Sub のプロジェクト ID です。

pubSubTopic (String!)
Google Cloud Pub/Sub のトピック ID。

WebhookSubscription object

Webhook の購読を表します。そのトピックのイベントが発生すると、Shopify は関連するデータオブジェクトを含む POST リクエストを指定されたエンドポイントに送信します。webhooks システムについて詳しくはこちら

フィールド

createdAt (DateTime!)
Webhook サブスクリプションが作成された日付と時間。

endpoint (WebhookSubscriptionEndpoint!)
Webhook が配信されるエンドポイント。

format (WebhookSubscriptionFormat!)
Webhook サブスクリプションがデータを送信する際のフォーマットです。

id (ID!)
グローバルに一意な識別子。

includeFields ([[String!](https://shopify.dev/api/admin/graphql/reference/scalar#string-2021-07)]!)
webhook サブスクリプションに含まれるフィールドのリストです。

legacyResourceId (UnsignedInt64!)
REST Admin API 内の対応するリソースの ID。

metafieldNamespaces ([String!]!)
Webhook サブスクリプションに含まれるべき任意のメタフィールドの名前空間のリストです。

topic (WebhookSubscriptionTopic!)
Webhook をトリガするイベントのタイプ。トピックは、Webhook サブスクリプションがいつ Webhook を送信するか、またその Webhook が含むデータ オブジェクトのクラスを決定します。

updatedAt (DateTime!)
Webhook サブスクリプションが更新された日時。

WebhookSubscription の返却型

WebhookSubscription のミューテーション

webhookSubscriptionCreate
新しい webhook サブスクリプションを作成します。

webhookSubscriptionDelete
ウェブフック・サブスクリプションを削除します。

webhookSubscriptionUpdate
ウェブフック・サブスクリプションを更新します。

Implements

非推奨フィールド

  • callbackUrl (URL!) deprecated
    イベント発生時に Webhook サブスクリプションが POST リクエストを送るべき URL。

Samples

query
# 1つのWebhookサブスクリプションのID、トピック、エンドポイントを取得する
{
  webhookSubscription(id: "gid://shopify/WebhookSubscription/704839155734") {
    id
    topic
    endpoint {
      __typename
      ... on WebhookHttpEndpoint {
        callbackUrl
      }
      ... on WebhookEventBridgeEndpoint {
        arn
      }
    }
  }
}
response
{
  "data": {
    "webhookSubscription": null
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 2,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}
query
# 最初の5つのWebhookサブスクリプションのID、トピック、エンドポイントを取得する
{
  webhookSubscriptions(first:5) {
    edges {
      node {
        id,
        topic,
        endpoint {
          __typename
          ... on WebhookHttpEndpoint {
            callbackUrl
          }
          ... on WebhookEventBridgeEndpoint {
            arn
          }
        }
      }
    }
  }
}
response
{
  "data": {
    "webhookSubscriptions": {
      "edges": [
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/704839188502",
            "topic": "APP_SUBSCRIPTIONS_UPDATE",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://smsbump.com/shopify/webhookcharges2"
            }
          }
        },
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/704839221270",
            "topic": "APP_SUBSCRIPTIONS_UPDATE",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://smsbump.com/shopify/webhookcharges3"
            }
          }
        },
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/723288031254",
            "topic": "APP_UNINSTALLED",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://x.com/order-created-callback"
            }
          }
        },
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/723288096790",
            "topic": "APP_UNINSTALLED",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://google.com/order-created-callback"
            }
          }
        },
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/723892273174",
            "topic": "APP_UNINSTALLED",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://xy.com/order-created-callback"
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 12,
      "actualQueryCost": 12,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 988,
        "restoreRate": 50
      }
    }
  }
}
query
# Get the first two webhook subscriptions with an APP_UNINSTALLED topic
{
  webhookSubscriptions(first: 2, topics: APP_UNINSTALLED) {
    edges {
      node {
        id
        topic
        endpoint {
          __typename
          ... on WebhookHttpEndpoint {
            callbackUrl
          }
          ... on WebhookEventBridgeEndpoint {
            arn
          }
        }
      }
    }
  }
}
response
{
  "data": {
    "webhookSubscriptions": {
      "edges": [
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/723288031254",
            "topic": "APP_UNINSTALLED",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://x.com/order-created-callback"
            }
          }
        },
        {
          "node": {
            "id": "gid://shopify/WebhookSubscription/723288096790",
            "topic": "APP_UNINSTALLED",
            "endpoint": {
              "__typename": "WebhookHttpEndpoint",
              "callbackUrl": "https://google.com/order-created-callback"
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 6,
      "actualQueryCost": 6,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 994,
        "restoreRate": 50
      }
    }
  }
}
query
# 特定のWebhookをトリガーしたイベントの種類を取得する
{
  webhookSubscription(id:"gid://shopify/WebhookSubscription/704839122966") {
    topic
  }
}
response
{
  "data": {
    "webhookSubscription": null
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}
query
# Webhookサブスクリプションがデータを送信する際のフォーマットを取得する
{
  webhookSubscription(id:"gid://shopify/WebhookSubscription/704839122966") {
    format
  }
}
response
{
  "data": {
    "webhookSubscription": null
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}
query
# `node`フィールドとGraphQLフラグメントを使って、特定のWebhookサブスクリプションを取得する
{
  node(id:"gid://shopify/WebhookSubscription/704839122966") {
    ... on WebhookSubscription {
      id
      createdAt
      updatedAt
      legacyResourceId
      topic
      format
    }
  }
}
response
{
  "data": {
    "node": null
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 999,
        "restoreRate": 50
      }
    }
  }
}

MUTATIONS

eventBridgeWebhookSubscriptionCreate mutation

新しい Amazon EventBridge webhook サブスクリプションを作成します。

Intaractive example

これはミューテーションクエリの例です。

query
mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {
  eventBridgeWebhookSubscriptionCreate(
    topic: $topic
    webhookSubscription: $webhookSubscription
  ) {
    userErrors {
      field
      message
    }
    webhookSubscription {
      id
    }
  }
}

Variables

{
  "topic": "placeholder",
  "webhookSubscription": {}
}

引数

引数 詳細
topic
( WebhookSubscriptionTopic! ) required
Webhook のトリガーとなるイベントの種類です。
webhookSubscription
( EventBridgeWebhookSubscriptionInput! ) required
EventBridge webhook サブスクリプションの入力フィールドを指定します。

EventBridgeWebhookSubscriptionInput フィールド

arn (ARN)
EventBridge イベントソースの ARN。

format (WebhookSubscriptionFormat)
Webhook サブスクリプションがデータを送信する際のフォーマットです。

includeFields ([String!])
Webhook サブスクリプションに含まれるフィールドのリストです。

metafieldNamespaces ([String!])
webhook サブスクリプションに含まれるべきメタフィールドの名前空間のリストです。

返却フィールド

userErrors ([UserError!]!)
変異を実行して発生したエラーのリストです。

webhookSubscription (WebhookSubscription)
作成された Webhook サブスクリプションです。

eventBridgeWebhookSubscriptionUpdate mutation

Amazon EventBridge webhook サブスクリプションを更新します。

Interactive example

以下はミューテーションクエリの例です。

query
mutation eventBridgeWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {
  eventBridgeWebhookSubscriptionUpdate(
    id: $id
    webhookSubscription: $webhookSubscription
  ) {
    userErrors {
      field
      message
    }
    webhookSubscription {
      id
    }
  }
}

Variables

{
  "id": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=",
  "webhookSubscription": {}
}

引数

引数 詳細
id ( ID! ) required 更新する Webhook サブスクリプションの ID です。
webhookSubscription ( EventBridgeWebhookSubscriptionInput! ) required EventBridge webhook サブスクリプションの入力フィールドを指定します。

EventBridgeWebhookSubscriptionInput フィールド

arnARN
EventBridge のイベントソースの ARN です。

format (WebhookSubscriptionFormat)
Webhook サブスクリプションがデータを送信する際のフォーマットです。

includeFields ([String!])
Webhook サブスクリプションに含まれるフィールドのリストです。

metafieldNamespaces ([String!])
webhook サブスクリプションに含まれるべきメタフィールドの名前空間のリストです。

返却フィールド

userErrors ([UserError!]!)
ミューテーションを実行して発生したエラーのリストです。

webhookSubscription (WebhookSubscription)
更新された Webhook サブスクリプションです。

flowTriggerReceive mutation

Shopify Flow でマーチャントが定義したワークフローをトリガーします。詳しくは、Shopify Flow トリガーの作成をご覧ください。

Interactive example

以下はミューテーションクエリの例です。

mutation flowTriggerReceive($body: String!) {
  flowTriggerReceive(body: $body) {
    userErrors {
      field
      message
    }
  }
}

Variables

{
  "body": "placeholder"
}

引数

引数 詳細
body ( String! ) required トリガーの実行に必要なペイロード。

返却型

userErrors ([UserError!]!)
変異を実行した際に発生したエラーのリスト。

webhookSubscriptionCreate mutation

新しい Webhook サブスクリプションを作成します。

Interactive example

以下は、ミューテーションクエリの例です。

mutation webhookSubscriptionCreate(
  $topic: WebhookSubscriptionTopic!
  $webhookSubscription: WebhookSubscriptionInput!
) {
  webhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {
    userErrors {
      field
      message
    }
    webhookSubscription {
      id
    }
  }
}

Variables

{
  "topic": "placeholder",
  "webhookSubscription": {}
}

引数

引数 詳細
topic ( WebhookSubscriptionTopic! ) required Webhook のトリガーとなるイベントの種類です。
webhookSubscription ( WebhookSubscriptionInput! ) required Webhook サブスクリプションの入力フィールドを指定します。

WebhookSubscriptionInput フィールド

callbackUrl (URL)
イベント発生時に Webhook サブスクリプションが POST リクエストを送信するべき URL。

format (WebhookSubscriptionFormat)
Webhook サブスクリプションがデータを送信する必要のあるフォーマット。

includeFields ([String!])
Webhook サブスクリプションに含まれるフィールドのリストです。

metafieldNamespaces ([String!])
webhook サブスクリプションに含まれるべきメタフィールドの名前空間のリストです。

返却フィールド

userErrors ([UserError!]!)
ミューテーションを実行して発生したエラーのリストです。

webhookSubscription (WebhookSubscription)
作成された Webhook サブスクリプションです。

webhookSubscriptionDelete mutation

Webhook サブスクリプションを削除します。

Interactive example

以下はミューテーションの例です。

mutation webhookSubscriptionDelete($id: ID!) {
  webhookSubscriptionDelete(id: $id) {
    deletedWebhookSubscriptionId
    userErrors {
      field
      message
    }
  }
}

Variables

{
  "id": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE="
}

引数

引数 詳細
id ( ID! ) required 削除する Webhook サブスクリプションの ID です。

返却フィールド

deletedWebhookSubscriptionId (ID)
削除された Webhook サブスクリプションの ID です。

userErrors ([UserError!]!)
ミューテーションを実行して発生したエラーのリストです。

webhookSubscriptionUpdate mutation

Webhook サブスクリプションを更新します。

Interactive example

以下はミューテーションクエリの例です。

  webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
    userErrors {
      field
      message
    }
    webhookSubscription {
      id
    }
  }
}

Variables

{
  "id": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=",
  "webhookSubscription": {}
}

引数

引数 詳細
id ( ID! ) required 更新する Webhook サブスクリプションの ID です。
webhookSubscription ( WebhookSubscriptionInput! ) required Webhook サブスクリプションの入力フィールドを指定します。

WebhookSubscriptionInput fields

callbackUrl (URL)
イベント発生時に Webhook サブスクリプションが POST リクエストを送信するべき URL。

format (WebhookSubscriptionFormat)
Webhook サブスクリプションがデータを送信する必要のあるフォーマット。

includeFields ([String!])
Webhook サブスクリプションに含まれるフィールドのリストです。

metafieldNamespaces ([String!])
webhook サブスクリプションに含まれるべきメタフィールドの名前空間のリストです。

返却フィールド

userErrors ([UserError!]!)
変異を実行して発生したエラーのリストです。

webhookSubscription (WebhookSubscription)
更新された Webhook サブスクリプションです。

INTERFACE

CommentEventSubject interface

コメントイベントの件名です。

フィールド

hasTimelineComment (Boolean!)
タイムライン・サブジェクトがタイムライン・コメントを持っているかどうか。true の場合、タイムラインコメントが存在することになります。

id (ID!)
グローバルに一意な識別子。

CommentEventSubject を実装するタイプ

Event interface

イベントは、記事の作成、注文の履行、製品の追加など、リソースの活動を記録します。

フィールド

appTitle (String)
イベントを作成したアプリの名前。

attributeToAppBoolean!)。
イベントがアプリによって作成されたかどうか。

attributeToUserBoolean!)
イベントが管理者ユーザーによって引き起こされたかどうか。

createdAt (DateTime!)
イベントが作成された日付と時間。

criticalAlertBoolean!)
イベントがクリティカルであるかどうか。

id (ID!)
グローバルに一意な識別子。

message (FormattedString!)
イベントを説明する人間が読めるテキスト。

イベントを実装する型

HasEvents interface

互換性のあるホスト上のイベントレコードへのコネクタ。

フィールド

events (EventConnection!)
ホスト・サブジェクトに関連するイベントのページングされたリスト。

引数 詳細
after ( String ) 指定されたカーソルの後に続く要素を返します。
before ( String ) 指定されたカーソルの前にある要素を返します。
first ( Int ) リストから最初のn個の要素までを返します。
last ( Int ) リストから最後のn個までの要素を返します。
query ( String ) サポートされているフィルタパラメータ。
comments
created_at
subject_type
verb
フィルターの使い方の詳細は、詳細な検索構文を参照してください。
reverse ( Boolean ) 対象となるリストの順序を逆にします。デフォルト値:false
sortKey ( EventSortKeys ) 基礎となるリストを、与えられたキーでソートします。デフォルトの値です。id

HasEvents を実装するリスト

INPUTS

EventBridgeWebhookSubscriptionInput input object

EventBridge webhook サブスクリプションの入力フィールドを指定します。

Input フィールド

arn (ARN)
EventBridge のイベントソースの ARN です。

format (WebhookSubscriptionFormat)
Webhook サブスクリプションがデータを送信する際のフォーマットです。

includeFields ([String!])
Webhook サブスクリプションに含まれるフィールドのリストです。

metafieldNamespaces ([String!])
webhook サブスクリプションに含まれるべきメタフィールドの名前空間のリストです。

WebhookSubscriptionInput input object

Webhook サブスクリプションの入力フィールドを指定します。

Input fields

callbackUrl (URL)
イベント発生時に Webhook サブスクリプションが POST リクエストを送信するべき URL。

format (WebhookSubscriptionFormat)
Webhook サブスクリプションがデータを送信する必要のあるフォーマット。

includeFields ([String!])
Webhook サブスクリプションに含まれるフィールドのリストです。

metafieldNamespaces ([String!])
webhook サブスクリプションに含まれるべきメタフィールドの名前空間のリストです。

ENUMS

DeletionEventSortKeys enum

DeletionEvent クエリの有効なソートキーのセットです。

Values

CREATED_AT
created_atの値でソートします。

ID
id の値でソートします。

RELEVANCE
検索時(接続時にquery・パラメータが指定されている場合)に、検索語との関連性で結果をソートします。検索クエリが指定されていない場合、このソートキーは確定的ではないため、使用しないでください。

DeletionEventSubjectType enum

削除イベントでサポートされているサブジェクトタイプ

Values

COLLECTION
PRODUCT

DeletionEventSubjectType を返す型

EventSortKeys enum

イベントクエリの有効なソートキーのセット。

Values

CREATED_AT
created_atの値でソートします。

ID
idの値でソートします。

関連性
検索時(接続時にquery・パラメータが指定されている場合)に、検索語との関連性で結果をソートします。検索クエリが指定されていない場合、このソートキーは確定的ではないため、使用しないでください。

WebhookSubscriptionFormat enum

Webhook サブスクリプションでサポートされているフォーマットです。

Values

JSON
XML

WebhookSubscriptionFormat を返す型

WebhookSubscriptionSortKeys enum

WebhookSubscription クエリで有効なソートキーのセットです。

Values

CREATED_AT
created_atの値でソートします。

id
ID の値でソートします。

RELEVANCE
検索時(接続時にクエリ・パラメータが指定されている場合)に、検索語との関連性で結果をソートします。検索クエリが指定されていない場合、このソートキーは確定的ではないため、使用しないでください。

WebhookSubscriptionTopic enum

Webhook サブスクリプションでサポートされているトピックです。

Values

APP_PURCHASES_ONE_TIME_UPDATE
app_purchases_one_time/update イベントの Webhook トピックです。

APP_SUBSCRIPTIONS_UPDATE
app_subscriptions/update イベント用の webhook トピックです。

APP_UNINSTALLED
app/uninstalled イベント用の webhook トピックです。

ATTRIBUTED_SESSIONS_FIRST
attributed_sessions/first イベント用の webhook トピックです。

ATTRIBUTED_SESSIONS_LAST
attributed_sessions/last イベント用の webhook トピックです。

CARTS_CREATE
carts/create イベント用の webhook トピックで

CARTS_UPDATE
carts/update イベント用の webhook トピックです。

CHANNELS_DELETE
channels/delete イベント用の webhook トピックです。

CHECKOUTS_CREATE
checkouts/create イベント用の webhook トピックです。

CHECKOUTS_DELETE
checkouts/delete イベント用の webhook トピック。

CHECKOUTS_UPDATE
checkouts/update イベント用の webhook トピック。

COLLECTIONS_CREATE
collections/create イベント用の webhook トピックです。

COLLECTIONS_DELETE
collections/delete イベント用の webhook トピックです。

COLLECTIONS_UPDATE
collections/update イベント用の webhook トピックです。

COLLECTION_LISTINGS_ADD
collection_listings/add イベント用の webhook トピックです。

COLLECTION_LISTINGS_REMOVE
collection_listings/remove イベント用の webhook トピックです。

COLLECTION_LISTINGS_UPDATE
collection_listings/update イベント用の webhook トピックです。

COLLECTION_PUBLICATIONS_CREATE
collection_publications/create イベント用の webhook トピックです。

COLLECTION_PUBLICATIONS_DELETE
collection_publications/delete イベント用の webhook トピックです。

COLLECTION_PUBLICATIONS_UPDATE
collection_publications/update イベント用の Webhook トピックです。

CUSTOMERS_CREATE
customers/create イベント用の webhook トピックです。

CUSTOMERS_DELETE
customers/delete イベント用の webhook トピックです。

CUSTOMERS_DISABLE
customer/disable イベント用の webhook トピックです。

CUSTOMERS_ENABLE
customer/enable イベント用の webhook トピックです。

CUSTOMERS_UPDATE
customers/update イベント用の webhook トピックです。

CUSTOMER_GROUPS_CREATE
customer_groups/create イベント用の webhook トピックです。

CUSTOMER_GROUPS_DELETE
customer_groups/delete イベント用の webhook トピックです。

CUSTOMER_GROUPS_UPDATE
customer_groups/update イベント用の webhook トピックです。

CUSTOMER_PAYMENT_METHODS_CREATE
customer_payment_methods/create イベント用の webhook トピックです。

CUSTOMER_PAYMENT_METHODS_REVOKE
customer_payment_methods/revoke イベント用の webhook トピックです。

CUSTOMER_PAYMENT_METHODS_UPDATE
customer_payment_methods/update イベント用の webhook トピックです。

DISPUTES_CREATE
disputes/create イベント用の webhook トピックです。

DISPUTES_UPDATE
disputes/update イベント用の webhook トピックです。

DOMAINS_CREATE
domain/create イベント用の webhook トピックです。

DOMAINS_DESTROY
domains/destroy イベント用の webhook トピックです。

DOMAINS_UPDATE
domains/update イベント用の webhook トピックです。

DRAFT_ORDERS_CREATE
draft_orders/create イベント用の webhook トピックです。

DRAFT_ORDERS_DELETE
draft_orders/delete イベント用の webhook トピックです。

DRAFT_ORDERS_UPDATE
draft_orders/update イベント用の webhook トピックです。

FULFILLMENTS_CREATE
fulfillments/create イベント用の webhook トピックです。

FULFILLMENTS_UPDATE
fulfillments/update イベント用の webhook トピックです。

FULFILLMENT_EVENTS_CREATE
fulfillment_events/create イベント用の webhook トピックです。

FULFILLMENT_EVENTS_DELETE
fulfillment_events/delete イベント用の webhook トピックです。

INVENTORY_ITEMS_CREATE
inventory_items/create イベント用の webhook トピックです。

INVENTORY_ITEMS_DELETE
inventory_items/delete イベント用の webhook トピックです。

INVENTORY_ITEMS_UPDATE
inventory_items/update イベント用の webhook トピックです。

INVENTORY_LEVELS_CONNECT
inventory_levels/connect イベント用の webhook トピックです。

INVENTORY_LEVELS_DISCONNECT
inventory_levels/disconnect イベント用の webhook トピックです。

INVENTORY_LEVELS_UPDATE
inventory_levels/update イベント用の webhook トピックです。

LOCALES_CREATE
locales/create イベント用の webhook トピックです。

LOCALES_UPDATE
locales/update イベント用の webhook トピックです。

LOCATIONS_CREATE
location/create イベント用の webhook トピックです。

LOCATIONS_DELETE
location/delete イベント用の webhook トピックを掲載しています。

LOCATIONS_UPDATE
location/update イベント用の webhook トピックです。

ORDERS_CANCELLED
order/cancelled イベント用の webhook トピックです。

ORDERS_CREATE
order/create イベント用の webhook トピックです。

ORDERS_DELETE
order/delete イベント用の webhook トピックです。

ORDERS_EDITED
order/edited イベント用の webhook トピックです。

ORDERS_FULFILLED
order/fulfilled イベント用の webhook トピックです。

ORDERS_PAID
order/paid イベント用の webhook トピックです。

ORDERS_PARTIALLY_FULFILLED
order/partially_fulfilled イベント用の webhook トピックです。

ORDERS_UPDATED
order/updated イベント用の webhook トピックです。

ORDER_TRANSACTIONS_CREATE
order_transactions/create イベント用の webhook トピックです。

PRODUCTS_CREATE
products/create イベント用の webhook トピックです。

PRODUCTS_DELETE
products/delete イベント用の webhook トピックです。

PRODUCTS_UPDATE
products/update イベント用の webhook トピックです。

PRODUCT_LISTINGS_ADD
product_listings/add イベント用の webhook トピックです。

PRODUCT_LISTINGS_REMOVE
product_listings/remove イベント用の webhook トピックです。

PRODUCT_LISTINGS_UPDATE
product_listings/update イベント用の webhook トピックです。

PRODUCT_PUBLICATIONS_CREATE
product_publications/create イベント用の webhook トピックです。

PRODUCT_PUBLICATIONS_DELETE
product_publications/delete イベント用の webhook トピックです。

PRODUCT_PUBLICATIONS_UPDATE
product_publications/update イベント用の Webhook トピックです。

PROFILES_CREATE
Profile/create イベント用の webhook トピックです。

PROFILES_DELETE
profiles/delete イベント用の webhook トピックです。

PROFILES_UPDATE
profiles/update イベント用の webhook トピックです。

REFUNDS_CREATE
返金/作成イベント用の webhook トピックです。

SHIPPING_ADDRESSES_CREATE
shipping_addresses/create イベント用の webhook トピックです。

SHIPPING_ADDRESSES_UPDATE
shipping_addresses/update イベント用の webhook トピックです。

SHOP_UPDATE
shop/update イベント用の webhook トピックです。

SUBSCRIPTION_BILLING_ATTEMPTS_FAILURE
subscription_billing_attempts/failure イベントに関する webhook トピックです。

SUBSCRIPTION_BILLING_ATTEMPTS_SUCCESS
subscription_billing_attempts/success イベントに関する webhook トピックです。

SUBSCRIPTION_CONTRACTS_CREATE
subscription_contracts/create イベントに関する webhook トピックです。

SUBSCRIPTION_CONTRACTS_UPDATE
subscription_contracts/update イベント用の webhook トピックです。

TAX_SERVICES_CREATE
tax_services/create イベント用の webhook トピックです。

TAX_SERVICES_UPDATE
tax_services/update イベント用の webhook トピックです。

TENDER_TRANSACTIONS_CREATE
tender_transactions/create イベント用の webhook トピックです。

THEMES_CREATE
themes/create イベント用の webhook トピックです。

THEMES_DELETE
themes/delete イベント用の webhook トピックです。

THEMES_PUBLISH
テーマ/イベントの発行に関する webhook トピック。

THEMES_UPDATE
Theme/update イベント用の webhook トピック。

VARIANTS_IN_STOCK
variants/in_stock イベント用の webhook トピックです。

VARIANTS_OUT_OF_STOCK
variants/out_of_stock イベント用の webhook トピックです。

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

Discussion

ログインするとコメントできます