Wix APIs support event-driven integrations, allowing you to respond to changes such as create, update, and delete actions. How you handle events depends on the API you use:
This article describes the structure of events for both REST webhooks and SDK event handlers.
REST webhook payloads contain a data object with the following fields, encoded as a JWT:
| Field | Description |
|---|---|
eventType | The event type. For example: wix.contacts.v4.contact_merged. |
instanceId | The app instance ID, which identifies the site where the event occurred. |
data | Event data object as a JSON string containing fields specific to the event type. The structure and fields are specific to each webhook. Refer to each webhook's reference for the exact structure and fields. |
identity | Identity object as a JSON string. |
SDK event handlers pass an event object with the following fields:
| Field | Description |
|---|---|
metadata | An object containing event metadata, including eventType, instanceId, identity, and other information about the event. The structure and fields are specific to each event. Refer to the event's reference for the exact structure and fields. |
entity | The state of the affected entity after the event occurs. |
modifiedFields | The updated fields and their values before the event occurred. Included for some updated events. |
In REST webhooks, the event data is in the data.data field.
In SDK events, the event data is in the event.metadata field, except for entity data.
The content of the event data varies by event type, but generally includes the following:
Refer to the documentation for each event to see the exact structure and fields included in its data.
modifiedFields objectSome updated events include a modifiedFields object. This object contains the values of fields that changed, as they were before the update. Use modifiedFields to compare old and new values or to track what changed.
The location of the modifiedFields object differs between REST webhooks and SDK events:
data.data.updatedEvent.modifiedFieldsevent.modifiedFieldsThe identity information includes the type and ID of the identity that triggered the event:
| Field name | Description |
|---|---|
identityType | Identity type that triggered this event. Supported values: ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP. See About Identities. |
| One of: | |
anonymousVisitorId | Site visitor ID. |
memberId | Site member ID. |
wixUserId | Wix user ID. |
appId | App ID. |
Some legacy REST webhooks don't follow the standard structure described above. For example, the legacy Wix Stores Product Changed webhook returns only the fields that changed with their updated values, in a flat list rather than the full object structure.