Keeping in sync

Sales channel apps typically feature products from many different Shopify merchants. The best way to keep your sales channel up-to-date with the data in merchants' stores is by using webhooks.

Channel-specific webhooks

Sales channel apps have access to all of Shopify's app webhook topics, and to six channel-specific topics:

  • product_listings/add
  • product_listings/update
  • product_listings/remove
  • collection_listings/add
  • collection_listings/update
  • collection_listings/remove

The add webhooks are triggered when a merchant publishes a product in your channel. Remove webhooks are triggered when a product is either destroyed or unpublished from your channel. An unpublished product may not have been permanently deleted, and could be added again in the future.

Sample webhook creation request

The following example shows a request that uses the product_listings/add webhook:

POST /admin/webhooks.json HTTP/1.1
Host: channelsrule.myshopify.com
X-Shopify-Access-Token: 085abas8bd90325c3f81s8e9c88befc0
Content-Type: application/json

{
    "webhook": {
        "topic": "product_listings/add",
        "address": "https://yourchannelapp.com/webhooks",
        "format": "json",
    }
}

That request returns a response that looks like this:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
X-Shopify-Shop-Api-Call-Limit: 1/40

{
    "webhook": {
        "id": 125777732,
        "address": "https://yourchannelapp.com/webhooks",
        "topic": "product_listings/add",
        "created_at": "2015-12-08T06:16:53+01:00",
        "updated_at": "2015-12-08T06:16:53+01:00",
        "format": "json",
        "fields": [],
        "metafield_namespaces": []
    }
}

Update orders

Depending on the transaction, your sales channel might need to update an order that has been created in Shopify. For more information about changes that you can make to the order after the purchase is complete, refer to the Refunds API, the Transactions API, and the Orders API.