Skip to main content

Overview of Webhooks

Webhooks allow extension to stay in sync with Fynd Platform data or perform an action after a specific event occurs in a store. Webhooks are a performant alternative to continuously polling for changes to a store’s data.

For example, a webhook can notify your extension when any customer places an order from your website. Your extension can then perform an action when the order is placed.

One more example is that a webhook can notify your extension when any product is gone out of stock. Your extension can then perform an action when the product is out of stock.

This guide introduces how webhooks work, including how to configure a webhook for your extensions.

Webhook Concepts

  • Webhook: A single event message. Fynd Platform sends a webhook to an extension’s webhook subscription endpoint. A webhook contains a JSON payload in the body and some metadata.

  • Webhook topic: A class of webhook events. A topic controls when webhook events are created and what's in the webhook payload. For example, orders/placed webhook events are sent whenever an order is created for a store and contain the new order as the payload.

  • Webhook URL: Also known as a webhook endpoint, it's the URL on which you want us to send the webhook data (payload). Please ensure that your webhook URL adheres to the following criteria:

    • It should be an HTTPS URL
    • It should be a publicly accessible URL
    • Authentication is recommended but it's not mandatory
  • Event: It is the action performed by your staff and customers. We support notifications (webhooks) for multiple types of events, such as the creation of a product, deletion of an order, and many more.

  • Webhook Subscription: A list of events for which you have chosen to receive notifications on your app or server.

  • Payload: It is the data related to the event you've subscribed to. Generally, the payload which we send to your webhook URL is in JSON format and you can utilize it as per your business use-case.

Use Cases

Common webhook use cases include the following:

  • Sending WhatsApp notifications to a customer when a customer places an order.
  • Collecting data for data warehousing.
  • Notify when the product is out of stock.
  • Removing customer data from a database for extension uninstalls.

Webhooks vs Continuous Polling

The steps below describe an example of how events publish to the orders/placed webhook topic:

  • The extension subscribes to the orders/placed topic for a store and listens for order placed events.
  • The extension specifies an HTTPS endpoint hosted by the extension server, to receive events for the topic.
  • An order on the store is created.
  • The event is published to the orders/placed topic.
  • Fynd Platform sends the webhook with an order payload to the registered subscription endpoint.