webhook Subscriptionquery
Returns a webhook subscription by ID.
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 ID of the WebhookSubscription to return.
WebhookSubscription possible returns
Anchor to WebhookSubscriptionWebhookSubscription A webhook subscription is a persisted data object created by an app using the REST Admin API or GraphQL Admin API. It describes the topic that the app wants to receive, and a destination where Shopify should send webhooks of the specified topic. When an event for a given topic occurs, the webhook subscription sends a relevant payload to the destination. Learn more about the webhooks system.
Code examples for QUERY: webhookSubscription
Query Reference for QUERY: webhookSubscription
"{\n webhookSubscription(id) {\n # WebhookSubscription fields\n }\n}"
Input Reference for QUERY: webhookSubscription
Schema Reference for QUERY: webhookSubscription
Display Examples for QUERY: webhookSubscription
[ { "example": { "type_name": "webhooksubscription", "title": "Get a single webhook subscription's ID, topic, and endpoint", "query_string": "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n}", "query_arguments": { "id": "gid://shopify/WebhookSubscription/892403750" }, "response": { "data": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/892403750", "topic": "ORDERS_CANCELLED", "endpoint": { "__typename": "WebhookHttpEndpoint", "callbackUrl": "https://example.org/fully_loaded_1" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/webhook_subscription_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\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { id topic endpoint { __typename ... on WebhookHttpEndpoint { callbackUrl } ... on WebhookEventBridgeEndpoint { arn } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the WebhookSubscription to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/WebhookSubscription/892403750\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "webhooksubscription", "title": "Get a specific webhook subscription using the `node` field and a GraphQL fragment", "query_string": "query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n}", "query_arguments": { "id": "gid://shopify/WebhookSubscription/892403750" }, "response": { "data": { "node": { "id": "gid://shopify/WebhookSubscription/892403750", "createdAt": "2021-12-01T10:23:43Z", "updatedAt": "2021-12-01T10:23:43Z", "legacyResourceId": "892403750", "topic": "ORDERS_CANCELLED", "format": "JSON" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/webhook_subscription_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\": \"query { node(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic format } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\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 query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\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 query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the WebhookSubscription to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/WebhookSubscription/892403750\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "webhooksubscription", "title": "Get the dates a webhook subscription was created and updated", "query_string": "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n}", "query_arguments": { "id": "gid://shopify/WebhookSubscription/892403750" }, "response": { "data": { "webhookSubscription": { "createdAt": "2021-12-01T10:23:43Z", "updatedAt": "2021-12-01T10:23:43Z" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/webhook_subscription_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\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { createdAt updatedAt } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the WebhookSubscription to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/WebhookSubscription/892403750\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "webhooksubscription", "title": "Get the format in which the webhook subscription serializes the payload", "query_string": "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n}", "query_arguments": { "id": "gid://shopify/WebhookSubscription/892403750" }, "response": { "data": { "webhookSubscription": { "format": "JSON" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/webhook_subscription_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\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { format } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the WebhookSubscription to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/WebhookSubscription/892403750\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "webhooksubscription", "title": "Get the topic of a webhook subscription", "query_string": "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n}", "query_arguments": { "id": "gid://shopify/WebhookSubscription/892403750" }, "response": { "data": { "webhookSubscription": { "topic": "ORDERS_CANCELLED" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/apps/test/unit/graph_api/admin/webhook_subscription_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\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { topic } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\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 query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the WebhookSubscription to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/WebhookSubscription/892403750\"", "typeKind": "QUERY" } ] } ]