When your app needs information about specific events that have occurred on a shop, it can subscribe to Shopify webhook topics as a mechanism for receiving near-real-time data about these events. Shopify webhooks are useful for keeping your app in sync with Shopify data, or as a trigger to perform an additional action after that event has occurred. They are also a performant alternative to continuously polling for changes to a shop's data. This guide provides a quick primer on when to use APIs versus webhooks, as well as key terminology and behaviors that are specific to Shopify webhooks. ### Examples of when your app might use webhooks * Sending notifications about changes in inventory levels to inventory management clients and pagers * Informing shipping companies about changes in orders, returns, or refunds * Removing customer data from a database for app uninstalls * Integrating data about orders with accounting software * Updating a product's warranty price based on changes to the product's price ## APIs for continuous polling vs. Webhooks for events data The following example uses the `orders/create` webhook topic to illustrate the difference between polling an API for data about events, versus subscribing to a webhook topic to receive data about events. 1. The app subscribes to the `orders/create` topic for a shop and listens for order creation events. 1. The app specifies an endpoint to receive webhooks for the `orders/create` topic. For example, this may be an HTTPS endpoint hosted by the app server. This endpoint is where the app listens for webhooks. 1. Suppose now that an order is created from that shop. 1. This triggers a webhook to be published to the `orders/create` topic. 1. Shopify sends that webhook, which includes headers and an order payload, to the specified subscription endpoint. ## Key terminology ### Webhook topic Webhooks are organized into topics. Your app subscribes to one or more topics to receive webhooks. Once installed on a shop, your app will receive webhooks each time that type of event is triggered for that shop. The **webhook topic** defines the kind of event messages that your app receives. For example, your app can subscribe to the `products/create` topic to be notified about new products that are created. The topic name identifies the nature of the event that's occurred. > Info: > Webhooks are divided by topic. Refer to the [Webhooks references](/docs/api/webhooks) for the complete list of supported webhook topics. ### Webhook subscription A **webhook subscription** declares the app’s intention to receive webhooks for a topic. A subscription is defined by: * The topic name * The subscription endpoint The endpoint is the destination that Shopify sends the webhooks to. This can be either a cloud-based event bus, or HTTPS. Today, Shopify provides support for, and is integrated with, Google Pub/Sub and Amazon EventBridge. Shopify recommends using Google Pub/Sub whenever possible. ### Headers Each webhook is made up of **headers** and a **payload**. Headers contain metadata about the webhook, like the shop that the app was installed on and where the event occurred.