Anchor to section titled 'undefined'

pubSubWebhookSubscriptionUpdate
mutation

Updates a Google Cloud Pub/Sub 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 id
id
required

The ID of the webhook subscription to update.

Specifies the input fields for a Google Cloud Pub/Sub webhook subscription.


Was this section helpful?

The list of errors that occurred from executing the mutation.

The webhook subscription that was updated.


Was this section helpful?

Examples

Hide code
Copy
mutation pubSubWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: PubSubWebhookSubscriptionInput!) {
pubSubWebhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation pubSubWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: PubSubWebhookSubscriptionInput!) { pubSubWebhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) { userErrors { field message } webhookSubscription { id topic endpoint { ... on WebhookPubSubEndpoint { pubSubProject pubSubTopic } } } } }",
"variables": {
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"pubSubProject": "a-gcp-project",
"pubSubTopic": "a-pubsub-topic",
"format": "JSON"
}
}
}'

const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
`#graphql
mutation pubSubWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: PubSubWebhookSubscriptionInput!) {
pubSubWebhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
}
}
}`,
{
variables: {
"id": "gid://shopify/WebhookSubscription/525699895",
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 pubSubWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: PubSubWebhookSubscriptionInput!) {
pubSubWebhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation pubSubWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: PubSubWebhookSubscriptionInput!) {
pubSubWebhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
}
}
}`,
"variables": {
"id": "gid://shopify/WebhookSubscription/525699895",
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
mutation pubSubWebhookSubscriptionUpdate($id: ID!, $webhookSubscription: PubSubWebhookSubscriptionInput!) {
pubSubWebhookSubscriptionUpdate(id: $id, webhookSubscription: $webhookSubscription) {
userErrors {
field
message
}
webhookSubscription {
id
topic
endpoint {
... on WebhookPubSubEndpoint {
pubSubProject
pubSubTopic
}
}
}
}
}
QUERY;

$variables = [
"id" => "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription" => [
Hide code
Input variables
Copy
{
"id": "gid://shopify/WebhookSubscription/525699895",
"webhookSubscription": {
"pubSubProject": "a-gcp-project",
"pubSubTopic": "a-pubsub-topic",
"format": "JSON"
}
}

Hide code
Response
JSON
{
"pubSubWebhookSubscriptionUpdate": {
"userErrors": [],
"webhookSubscription": {
"id": "gid://shopify/WebhookSubscription/525699895",
"topic": "ORDERS_CREATE",
"endpoint": {
"pubSubProject": "a-gcp-project",
"pubSubTopic": "a-pubsub-topic"
}
}
}
}