Re: Why do I see a deprecation waning for a "WebhookSubscriptionCreateMutation"?

Solved

Why do I see a deprecation waning for a "WebhookSubscriptionCreateMutation"?

sagar_at_avyya
Shopify Partner
31 1 17

For a simple call to the API as follows:

 

 mutation ($topic: WebhookSubscriptionTopic!, $callbackUrl: URL!) {
      webhookSubscriptionCreate(
        topic: $topic,
        webhookSubscription: {
          callbackUrl: $callbackUrl,
          format: JSON
        }) {
        userErrors {
          field
          message
        }
        webhookSubscription {
          id
          callbackUrl
        }
      }
    }

Why am I getting a Deprecation warning on the `2022-07` and `2022-10` versions?

 

 

 


Sagar @ Avyya - Modern Sales Booster
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hi @sagar_at_avyya 

 

The `WebhookSubscription.callbackUrl `field is deprecated as of 2022-07. You will want to use `WebhookSubscription.endpoint` when referencing the object field instead, and fragment on `WebhookSubscriptionEndpoint`

 

 

mutation webhookSubscriptionCreate(
    $wst: WebhookSubscriptionTopic!,
    $wsi: WebhookSubscriptionInput!) {
    webhookSubscriptionCreate(topic: $wst, webhookSubscription: $wsi) {
        webhookSubscription {
            id
            endpoint {
                ... Endpoints
            }
        }
        
    }
}

fragment Endpoints on WebhookSubscriptionEndpoint {
    ... on WebhookEventBridgeEndpoint {
        arn
    }
    ... on WebhookHttpEndpoint {
        callbackUrl
    }
    ... on WebhookPubSubEndpoint{
        pubSubProject
        pubSubTopic
    }
}

 

 

Keep in mind, this change is for the `WebhookSubscription` object, not the `WebhookSubscriptionInput` input object for the `webhookSubscriptionCreate` mutation.

 

Hope that helps! 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hi @sagar_at_avyya 

 

The `WebhookSubscription.callbackUrl `field is deprecated as of 2022-07. You will want to use `WebhookSubscription.endpoint` when referencing the object field instead, and fragment on `WebhookSubscriptionEndpoint`

 

 

mutation webhookSubscriptionCreate(
    $wst: WebhookSubscriptionTopic!,
    $wsi: WebhookSubscriptionInput!) {
    webhookSubscriptionCreate(topic: $wst, webhookSubscription: $wsi) {
        webhookSubscription {
            id
            endpoint {
                ... Endpoints
            }
        }
        
    }
}

fragment Endpoints on WebhookSubscriptionEndpoint {
    ... on WebhookEventBridgeEndpoint {
        arn
    }
    ... on WebhookHttpEndpoint {
        callbackUrl
    }
    ... on WebhookPubSubEndpoint{
        pubSubProject
        pubSubTopic
    }
}

 

 

Keep in mind, this change is for the `WebhookSubscription` object, not the `WebhookSubscriptionInput` input object for the `webhookSubscriptionCreate` mutation.

 

Hope that helps! 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog