Use webhooks to receive notifications about events taking place in Yotpo products.
How to use webhooks
When subscribing to webhooks, Yotpo will send the information in a JSON-formatted payload to your specified destination. The webhook is triggered for every event, for example, whenever a new customer subscribes to SMS marketing. After subscribing to webhooks, you will be able to manage them using the endpoints listed below.
To create a new webhook subscription (to one or more events), use the following endpoints, and in this order:
- Create a webhook target. Specify the callback URL of your destination app that will receive incoming notifications. The endpoint returns a target ID.
- Create a webhook filter. Specify all the events you want to include in this filter (see a list of available events below). The endpoint returns a filter ID.
- Subscribe to your webhook. To activate your webhook and start getting notifications, you must specify the target and filter IDs you received from the webhook target and webhook filter.
Your webhook target will be your callback URL. You can use your webhook target and webhook filter to create a subscription.
- Create target - Create a webhook target
- Retrieve targets - Retrieve a list of all of your webhook targets
- Retrieve target by ID - Retrieve a webhook target using its Yotpo ID
- Update target - Update a webhook target
- Delete target - Delete a webhook target
- Use only secure URLs that start with HTTPS
- URLs can have a maximum length of 2048 characters
- URLs must conform to RFC 2396
Your webhook filter lets you create a list of events to subscribe to. You can use your webhook target and webhook filter to create a subscription.
- Create filter - Create a webhook filter
- Retrieve filters - Retrieve a list of all of your webhook filters
- Retrieve filter by ID - Retrieve a webhook filter using its Yotpo ID
- Update filter - Update a webhook filter
- Delete filter - Delete a webhook filter
Your webhook subscription lets you subscribe to events and provides a target for the callback.
- Create subscription - Create a webhook subscription
- Retrieve subscriptions - Retrieve a list of all of your webhook subscriptions
- Retrieve subscription by ID - Retrieve a webhook subscription using its Yotpo ID
- Update subscription - Update a webhook subscription
- Delete subscription - Delete a webhook subscription
Ignoring duplicate events
To avoid processing duplicate messages by the target, every event sent to the target URL includes a header with an Eventld.
Example: 'eventid: 066c9f28-3e87-45d5-a67e-879d6090d989'
Response time and retries
We recommend responding to events as soon as possible, with a 200 OK response. We expect to get a 200 OK response within 5 seconds. If we do not receive the approval, we will try again.
If there is a disconnect, for example, due to network issues, we will retry sending messages. We will attempt a retry at least 10 times, using an exponential backoff retry.