Anchor to webhookSubscriptionUpdatewebhook
webhookSubscriptionUpdate
mutation
Updates a 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.
Anchor to Arguments
Arguments
- •ID!required
The ID of the webhook subscription to update.
- Anchor to webhookSubscriptionwebhook•
Subscription WebhookSubscription requiredInput! Specifies the input fields for a webhook subscription.
Was this section helpful?
Anchor to WebhookSubscriptionUpdatePayload returnsWebhookSubscriptionUpdatePayload returns
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to webhookSubscriptionwebhook•
Subscription The webhook subscription that was updated.
Was this section helpful?
- Modify an existing Webhook
- Update the callback URL of a webhook subscription
- webhookSubscriptionUpdate reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation WebhookSubscriptionUpdate($id: ID!, $webhookSubscription: WebhookSubscriptionInput!) {
webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
__typename
... on WebhookHttpEndpoint {
callbackUrl
}
... on WebhookEventBridgeEndpoint {
arn
}
... on WebhookPubSubEndpoint {
pubSubProject
mutation WebhookSubscriptionUpdate($id: ID!, $webhookSubscription: WebhookSubscriptionInput!) {
webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
__typename
... on WebhookHttpEndpoint {
callbackUrl
}
... on WebhookEventBridgeEndpoint {
arn
}
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
apiVersion {
handle
}
format
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation WebhookSubscriptionUpdate($id: ID!, $webhookSubscription: WebhookSubscriptionInput!) { webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) { userErrors { field message } webhookSubscription { id topic endpoint { __typename ... on WebhookHttpEndpoint { callbackUrl } ... on WebhookEventBridgeEndpoint { arn } ... on WebhookPubSubEndpoint { pubSubProject pubSubTopic } } apiVersion { handle } format } } }",
"variables": {
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"callbackUrl": "https://example.org/aValidEndpoint"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation WebhookSubscriptionUpdate($id: ID!, $webhookSubscription: WebhookSubscriptionInput!) {
webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
__typename
... on WebhookHttpEndpoint {
callbackUrl
}
... on WebhookEventBridgeEndpoint {
arn
}
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
apiVersion {
handle
}
format
}
}
}`,
{
variables: {
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"callbackUrl": "https://example.org/aValidEndpoint"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation WebhookSubscriptionUpdate($id: ID!, $webhookSubscription: WebhookSubscriptionInput!) {
webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
__typename
... on WebhookHttpEndpoint {
callbackUrl
}
... on WebhookEventBridgeEndpoint {
arn
}
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
apiVersion {
handle
}
format
}
}
}`,
"variables": {
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"callbackUrl": "https://example.org/aValidEndpoint"
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation WebhookSubscriptionUpdate($id: ID!, $webhookSubscription: WebhookSubscriptionInput!) {
webhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
__typename
... on WebhookHttpEndpoint {
callbackUrl
}
... on WebhookEventBridgeEndpoint {
arn
}
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
apiVersion {
handle
}
format
}
}
}
QUERY
variables = {
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"callbackUrl": "https://example.org/aValidEndpoint"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"callbackUrl": "https://example.org/aValidEndpoint"
}
}
Response
JSON{
"webhookSubscriptionUpdate": {
"userErrors": [],
"webhookSubscription": {
"id": "gid://shopify/WebhookSubscription/525699895",
"topic": "ORDERS_CREATE",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://example.org/aValidEndpoint"
},
"apiVersion": {
"handle": "unstable"
},
"format": "XML"
}
}
}