event Bridge Webhook Subscription Createmutation
Creates a new Amazon EventBridge webhook subscription.
Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your shopify.app.toml
may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read About managing webhook subscriptions.
Arguments
The type of event that triggers the webhook.
Specifies the input fields for an EventBridge webhook subscription.
EventBridgeWebhookSubscriptionCreatePayload returns
The list of errors that occurred from executing the mutation.
The webhook subscription that was created.
Code examples for MUTATION: eventBridgeWebhookSubscriptionCreate
Query Reference for MUTATION: eventBridgeWebhookSubscriptionCreate
"mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n userErrors {\n field\n message\n }\n webhookSubscription {\n # WebhookSubscription fields\n }\n }\n}"
Input Reference for MUTATION: eventBridgeWebhookSubscriptionCreate
"{\n \"topic\": \"APP_PURCHASES_ONE_TIME_UPDATE\",\n \"webhookSubscription\": {\n \"arn\": \"\",\n \"filter\": \"<your-filter>\",\n \"format\": \"JSON\",\n \"includeFields\": [\n \"<your-includeFields>\"\n ],\n \"metafieldNamespaces\": [\n \"<your-metafieldNamespaces>\"\n ]\n }\n}"
Schema Reference for MUTATION: eventBridgeWebhookSubscriptionCreate
"input EventBridgeWebhookSubscriptionInput {\n arn: ARN\n filter: String\n format: WebhookSubscriptionFormat\n includeFields: [String!]\n metafieldNamespaces: [String!]\n}\n"
Display Examples for MUTATION: eventBridgeWebhookSubscriptionCreate
[ { "example": { "type_name": "eventbridgewebhooksubscriptioncreate", "title": "Create a METAOBJECTS_CREATE EventBridge webhook subscription for lookbook metaobjects", "query_string": "mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n filter\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "topic": "METAOBJECTS_CREATE", "webhookSubscription": { "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source", "format": "JSON", "filter": "type:lookbook" } }, "response": { "data": { "eventBridgeWebhookSubscriptionCreate": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/7768084104", "topic": "METAOBJECTS_CREATE", "filter": "type:lookbook", "format": "JSON", "endpoint": { "__typename": "WebhookEventBridgeEndpoint", "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source" } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/mutations/event_bridge_webhook_subscription_create_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) { eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) { webhookSubscription { id topic filter format endpoint { __typename ... on WebhookEventBridgeEndpoint { arn } } } userErrors { field message } } }\",\n \"variables\": {\n \"topic\": \"METAOBJECTS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source\",\n \"format\": \"JSON\",\n \"filter\": \"type:lookbook\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n filter\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"topic\": \"METAOBJECTS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source\",\n \"format\": \"JSON\",\n \"filter\": \"type:lookbook\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n filter\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"topic\": \"METAOBJECTS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source\",\n \"format\": \"JSON\",\n \"filter\": \"type:lookbook\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n filter\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"topic\": \"METAOBJECTS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source\",\n \"format\": \"JSON\",\n \"filter\": \"type:lookbook\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n filter\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"topic\" => \"METAOBJECTS_CREATE\",\n \"webhookSubscription\" => [\n \"arn\" => \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source\",\n \"format\" => \"JSON\",\n \"filter\" => \"type:lookbook\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "topic", "description": "The type of event that triggers the webhook.", "type": { "kind": "ENUM", "name": "WebhookSubscriptionTopic", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "WebhookSubscriptionTopic!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "topic", "argValue": " \"METAOBJECTS_CREATE\"", "typeKind": "MUTATION" }, { "arg": { "name": "webhookSubscription", "description": "Specifies the input fields for an EventBridge webhook subscription.", "type": { "kind": "INPUT_OBJECT", "name": "EventBridgeWebhookSubscriptionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "EventBridgeWebhookSubscriptionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "webhookSubscription", "argValue": " {\"arn\":\"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/1830279/test-event-source\",\"format\":\"JSON\",\"filter\":\"type:lookbook\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "eventbridgewebhooksubscriptioncreate", "title": "Create an Amazon EventBridge webhook subscription for ORDERS_CREATE events", "query_string": "mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n}", "variables": { "topic": "ORDERS_CREATE", "webhookSubscription": { "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source", "format": "JSON" } }, "response": { "data": { "eventBridgeWebhookSubscriptionCreate": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/7768084103", "topic": "ORDERS_CREATE", "format": "JSON", "endpoint": { "__typename": "WebhookEventBridgeEndpoint", "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source" } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/mutations/event_bridge_webhook_subscription_create_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) { eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) { webhookSubscription { id topic format endpoint { __typename ... on WebhookEventBridgeEndpoint { arn } } } } }\",\n \"variables\": {\n \"topic\": \"ORDERS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"topic\": \"ORDERS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"topic\": \"ORDERS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"topic\": \"ORDERS_CREATE\",\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"topic\" => \"ORDERS_CREATE\",\n \"webhookSubscription\" => [\n \"arn\" => \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\" => \"JSON\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "topic", "description": "The type of event that triggers the webhook.", "type": { "kind": "ENUM", "name": "WebhookSubscriptionTopic", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "WebhookSubscriptionTopic!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "topic", "argValue": " \"ORDERS_CREATE\"", "typeKind": "MUTATION" }, { "arg": { "name": "webhookSubscription", "description": "Specifies the input fields for an EventBridge webhook subscription.", "type": { "kind": "INPUT_OBJECT", "name": "EventBridgeWebhookSubscriptionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "EventBridgeWebhookSubscriptionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "webhookSubscription", "argValue": " {\"arn\":\"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\"format\":\"JSON\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "eventbridgewebhooksubscriptioncreate", "title": "Create an ORDERS_CREATE EventBridge webhook subscription thatincludes metafields during serialization", "query_string": "mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n metafieldNamespaces\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n}", "variables": { "topic": "ORDERS_CREATE", "metafieldNamespaces": [ "MY_NAMESPACE", "ANOTHER_NAMESPACE" ], "webhookSubscription": { "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source", "format": "JSON" } }, "response": { "data": { "eventBridgeWebhookSubscriptionCreate": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/7768084105", "topic": "ORDERS_CREATE", "format": "JSON", "metafieldNamespaces": [], "endpoint": { "__typename": "WebhookEventBridgeEndpoint", "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source" } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/mutations/event_bridge_webhook_subscription_create_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) { eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) { webhookSubscription { id topic format metafieldNamespaces endpoint { __typename ... on WebhookEventBridgeEndpoint { arn } } } } }\",\n \"variables\": {\n \"topic\": \"ORDERS_CREATE\",\n \"metafieldNamespaces\": [\n \"MY_NAMESPACE\",\n \"ANOTHER_NAMESPACE\"\n ],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n metafieldNamespaces\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"topic\": \"ORDERS_CREATE\",\n \"metafieldNamespaces\": [\n \"MY_NAMESPACE\",\n \"ANOTHER_NAMESPACE\"\n ],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n metafieldNamespaces\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"topic\": \"ORDERS_CREATE\",\n \"metafieldNamespaces\": [\"MY_NAMESPACE\", \"ANOTHER_NAMESPACE\"],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n metafieldNamespaces\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"topic\": \"ORDERS_CREATE\",\n \"metafieldNamespaces\": [\n \"MY_NAMESPACE\",\n \"ANOTHER_NAMESPACE\"\n ],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n metafieldNamespaces\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"topic\" => \"ORDERS_CREATE\",\n \"metafieldNamespaces\" => [\"MY_NAMESPACE\", \"ANOTHER_NAMESPACE\"],\n \"webhookSubscription\" => [\n \"arn\" => \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\" => \"JSON\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "topic", "description": "The type of event that triggers the webhook.", "type": { "kind": "ENUM", "name": "WebhookSubscriptionTopic", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "WebhookSubscriptionTopic!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "topic", "argValue": " \"ORDERS_CREATE\"", "typeKind": "MUTATION" }, { "arg": { "name": "webhookSubscription", "description": "Specifies the input fields for an EventBridge webhook subscription.", "type": { "kind": "INPUT_OBJECT", "name": "EventBridgeWebhookSubscriptionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "EventBridgeWebhookSubscriptionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "webhookSubscription", "argValue": " {\"arn\":\"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\"format\":\"JSON\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "eventbridgewebhooksubscriptioncreate", "title": "Create an ORDERS_CREATE EventBridge webhook subscription with fewer resource fields", "query_string": "mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n includeFields\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n}", "variables": { "topic": "ORDERS_CREATE", "includeFields": [ "id", "note" ], "webhookSubscription": { "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source", "format": "JSON" } }, "response": { "data": { "eventBridgeWebhookSubscriptionCreate": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/7768084106", "topic": "ORDERS_CREATE", "format": "JSON", "includeFields": [], "endpoint": { "__typename": "WebhookEventBridgeEndpoint", "arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source" } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/mutations/event_bridge_webhook_subscription_create_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) { eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) { webhookSubscription { id topic format includeFields endpoint { __typename ... on WebhookEventBridgeEndpoint { arn } } } } }\",\n \"variables\": {\n \"topic\": \"ORDERS_CREATE\",\n \"includeFields\": [\n \"id\",\n \"note\"\n ],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n includeFields\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"topic\": \"ORDERS_CREATE\",\n \"includeFields\": [\n \"id\",\n \"note\"\n ],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n includeFields\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"topic\": \"ORDERS_CREATE\",\n \"includeFields\": [\"id\", \"note\"],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n includeFields\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"topic\": \"ORDERS_CREATE\",\n \"includeFields\": [\n \"id\",\n \"note\"\n ],\n \"webhookSubscription\": {\n \"arn\": \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\": \"JSON\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation eventBridgeWebhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {\n eventBridgeWebhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {\n webhookSubscription {\n id\n topic\n format\n includeFields\n endpoint {\n __typename\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"topic\" => \"ORDERS_CREATE\",\n \"includeFields\" => [\"id\", \"note\"],\n \"webhookSubscription\" => [\n \"arn\" => \"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\n \"format\" => \"JSON\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "topic", "description": "The type of event that triggers the webhook.", "type": { "kind": "ENUM", "name": "WebhookSubscriptionTopic", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "WebhookSubscriptionTopic!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "topic", "argValue": " \"ORDERS_CREATE\"", "typeKind": "MUTATION" }, { "arg": { "name": "webhookSubscription", "description": "Specifies the input fields for an EventBridge webhook subscription.", "type": { "kind": "INPUT_OBJECT", "name": "EventBridgeWebhookSubscriptionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "EventBridgeWebhookSubscriptionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "webhookSubscription", "argValue": " {\"arn\":\"arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/166357/test-event-source\",\"format\":\"JSON\"}", "typeKind": "MUTATION" } ] } ]