What are Webhooks?

A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application. The term "webhook" was coined by Jeff Lindsay in 2007 from the computer programming term "hook".

When an event occurs, information is sent to the endpoint via an API key. Webhook event data can be stored as JSON or XML.

Common cases where webhook is used include the following:

  • Send notifications to clients for quick access
  • Collection of data for storage
  • Integration with accounting software
  • Filtering order items and informing ordering companies
  • Customer data is removed from the database

How can I add a Webhook?

Go into your control panel > Settings > Webhooks > Add a webhook.
API key - From here, you select the API key. You can add "Default": This is the one you have automatically created in your store. You can also create a new API Key from the Settings > API keys.
Destination URL - This is the URL where the webhook will be sent.
Fire when - Here you choose the action for when the webhook will be executed.

An example I: If there is a new order, the action will execute the webhook to the destination of the specified URL.

An example II: You can see an example Webhook here: Order.json

When you receive a Webhook, you can expect statuses with the following content:

Order status:

pending, voided, timeouted, cancelled, failed, refunded, paid, complete

Payment status:

requested, pending, held, completed, failed, refunded, cancelled, timeouted

Fulfilment status:

not_fulfilled, fulfilld