About webhook events and data

Webhooks are a powerful automation tool. To properly use webhooks, it is important to understand when you receive them and what you can find inside.

Webhook events are triggers Ecwid uses to notify apps when something happens in the store. At its core, any webhook event consists of what was affected (entity) and how it was affected (action). So a customer.created webhook event tells you that a new customer was created in the store.

Webhook data refers to all essential details about the event sent to applications as a webhook body. Data includes timestamp, store and entity ID, and some additional details like order statuses.

When webhook events are triggered

Ecwid triggers webhooks every time this event happens in a store. Triggers work independently of the change source: Ecwid admin, storefront or checkout, REST API. In any case, changes trigger related webhooks.

For example, the order.created event triggers when a new order is created in the store including both orders placed through the checkout and orders created with REST API, the product.deleted event triggers when a product is deleted from the store both through Ecwid admin or with a REST API request.

Be careful with webhook processing. If you automate sending a product update REST API request upon receiving a product.updated webhook, you'll get into a loop of infinite product updates and webhooks.

When multiple events are triggered

When something changes in a store, the change could affect several entities. As a result, what you see as one "store event" can lead to multiple webhooks sent to an app. The most common example is a new order.

When a customer places a new order at the checkout, several things happen:

  • A new order is created.
  • Stock of products from the order is decreased.
  • A new customer is created or an existing customer is updated.

So if an app listens for all of the order.created, product.updated, customer.created, and customer.updated, it will receive three or more webhooks from a single "store event". Make sure your application reacts to different events properly.

Data contained in webhook body

When you receive a webhook, you get some information about the event. Ecwid doesn't send full details to keep webhooks fast, but it is enough for making automation.

Webhook requests contain the following fields in the request body:

FieldTypeDescription
eventIdstringUnique ID for the webhook event. Useful when you receive several webhooks about the same entity in a short period.
eventCreatednumberUNIX timestamp when the event happened in a store.
storeIdnumberEcwid store ID where a webhook event happened.
entityIdstringID of the entity. Can contain ID of product, order, category, invoice, etc. depending on the event type.
eventTypestringWebhook event happened in the store. Tells what was changed and how it was changed.
Read more about supported webhook events.
dataarray{data}(Optional). Additional information about some webhook events.

data

Webhook request body for events like order.created, profile.subscriptionStatusChanged, customer.created, and invoiceCreated contains additional data about the event.

NameTypeDescription
orderIdstringOrder ID. Available for the following events: order.created, order.updated, order.deleted, invoice.created, invoice.deleted.
cartIdstringAbandoned cart ID. Available for the following events: unfinished_order.created, unfinished_order.updated, unfinished_order.deleted.
oldPaymentStatusstringOrder payment status before changes. Available for the following events: order.updated.
newPaymentStatusstringOrder payment status after changes. Available for the following events: order.created, order.updated.
oldFulfillmentStatusstringOrder fulfillment (shipping) status before changes. Available for the following events: order.updated.
newFulfillmentStatusstringOrder fulfillment (shipping) status after changes. Available for the following events: order.created, order.updated.
oldSubscriptionNamestringEcwid subscription plan before changes. Available for the following events: profile.subscriptionStatusChanged.
newSubscriptionNamestringEcwid subscription plan after changes. Available for the following events: profile.subscriptionStatusChanged.
oldSubscriptionStatusstringApplication subscription status before changes. Available for the following events: application.subscriptionStatusChanged.
newSubscriptionStatusstringApplication subscription status after changes. Available for the following events: application.subscriptionStatusChanged.
customerEmailstringCustomer email. Available for the following events: customer.created, customer.updated, customer.deleted.

Check out webhook body examples.