Doing business online requires many of your web apps to stay in frequent communication. Webhooks make this end-to-end workflow seamless. They push information back and forth using secure, simple, automated messages.
This back-and-forth is essential for ecommerce. For an online business to function, it needs to integrate several different entities such as payment systems, banks, inventory management software, customer relationship management (CRM) systems, and more, so they can share data and take action whenever a triggering event occurs.
This article explores what webhooks are, how they’re a reliable method for executing information technology (IT) functions, why businesses need them, and when they’re most useful.
What are webhooks?
Webhooks are specialized services that connect web applications by automatically sending data over the internet from one application to another whenever a particular event occurs.
Webhooks allow web apps to speak a common language so they can make the necessary HTTP requests (requests from web browsers to servers for content) and share new data in real time.
This data is known as a payload. In ecommerce, a payload may include details like a customer’s shipping address, product line items, or payment amounts.
Using webhooks provides an alternative to polling. With polling, a developer or application has to manually check for updates and request data from a server, which can tax your web server processing load. Webhooks remove the need for polling and reduce server load by automatically sending updates only when the server has new information.
When to use webhooks
You can use webhook integrations for many ecommerce business activities, including:
- Inventory updates. When a product’s stock level reaches a specific level, this triggers a notification message to suppliers.
- Payment confirmations. If the triggering action is a successful payment, accounting and customer support receive notifications.
- Customer returns. Webhooks can update inventory data and trigger refund processes.
- Lead generation. When a customer opts into email marketing, a webhook can send the lead information to a CRM system, automatically prompting the CRM to create a new lead record.
- Customer support. A customer support system can use webhooks to receive notifications about incoming phone calls, fetch customer data based on a caller ID, route calls to appropriate agents, or trigger post-call surveys and follow-up actions.
How webhooks work
Webhooks are implementations of what’s called an HTTP push application programming interface (API), or a push API. An API is a protocol or set of rules that lets you retrieve data and exchange functions between software applications. Push APIs pass information on to a receiving endpoint, also known as a callback URL (or redirect URI).
Webhooks allow a source web application to send out communication to a server when it has an update. The application is self-monitoring. Unlike with pull APIs, where a developer has to check or “poll” to source new information from an application, a webhook pushes, or sends out communication to a server only when there is new data to share.
When a triggering event occurs, the initiating system sends an automated message over HTTP. Message data travels to the webhook, which then pushes this data to other apps using the specific callback URL. Instead of asking, waiting, and checking for requested data, the client (also called the destination system or receiving application) gets notifications automatically whenever the data changes.
For a webhook to work, you need to program the client to process the incoming code and real-time data. Most webhooks use either JavaScript Object Notation (JSON) or Extensible Markup Language (XML) as their data format interchange code, although JSON has become the more popular standard.
Webhook example
Webhooks can help improve shipping speed and reduce human errors when fulfilling online orders by automatically printing a shipping label when an order is processed.
For example, say you have an online clothing store and use a payment processor to handle checkout. A customer makes a purchase, which triggers a webhook. That webhook carries the order details, such as items purchased, order ID, and shipping address, to the shipping provider’s system at the predefined unique URL.
Upon receiving the request, the shipping provider’s system executes a particular action (in this case, the generation of a shipping label) which prints automatically as soon as the transaction is complete.
Webhooks vs. API: What’s the difference?
While they share common functionalities, there are several differences between webhooks and APIs:
- Data exchange method. APIs connect systems, software, or computer programs that cannot share data with other systems, and developers plug them into their applications to add whatever functionalities they need. In contrast, webhooks are automated messages that get pushed after a triggering event.
- Type of communication. Both APIs and webhooks involve communication between apps, but APIs allow for two-way communication, and webhooks only allow for one-way communication as the result of a triggering event.
- Complexity. APIs are more complex than webhooks, as they can modify both the source system and target system during their request-response cycle. Webhooks, in contrast, can only respond to events occurring at the target system and cannot modify, update, or erase client data.
People sometimes refer to webhooks as reverse APIs due to the perceived reversed flow of data. In reality, webhooks are not true reverse APIs, but a unique type of real-time, event-driven communication.
Although they’re distinct mechanisms, most applications use webhooks and APIs together, and it’s unlikely for an application to use only one pattern.
For example, a location-based application might use a webhook to notify a server when a user’s location changes. The server might then use a Google Maps API to aggregate a list of nearby places of interest based on the new location.
How to use webhooks in Shopify
Shopify store owners can create webhooks that send data upon specific store-related events.
Webhook creation is available for both customer-related updates, such as when a shopper creates, revises, or deletes a cart, and vendor-specific functions, such as order fulfilment, inventory updates or stock changes, theme edits, and refunds.
To create a webhook in Shopify:
1. From your Shopify admin, navigate to Settings > Notifications.
2. Select Webhooks > Create webhook.
3. In the Event dropdown, select from the list of supported webhook events.
4. In the Format dropdown, select JSON or XML.
5. In the URL field, choose where you would like data to be stored.
6. In the Webhook API version field, choose your preferred webhook version.
7. Select Save.
What are webhooks FAQ
What is the difference between API and webhooks?
APIs and webhooks are mechanisms to connect apps so they can communicate and share data, but they function differently. APIs enable two-way communication, while webhooks trigger one-way communication when an event occurs (like a placed order). APIs and webhooks are often used together in applications. Webhooks notify an application when an event has occurred, while APIs retrieve, send, or update any additional data to complete the action.
When should you use webhooks?
Webhooks can be a lightweight solution for scenarios in which you need to connect different applications and services in real time, when a one-way push of data (versus two-way communication) is enough, and when you want to minimize server load, since webhooks cut the need for repeated polling requests.
How do you add webhooks?
Adding webhooks to an application depends on the specific platform. To add a webhook in Shopify, go to your settings and click Notifications. Select Webhooks and click Create Webhook, choose the specific event(s) that will trigger the webhook request, add a unique callback URL, and choose whether your webhook format will be JSON or XML.












