About webhooks

Introduction

Use webhooks to get notifications about events taking place in your Yotpo products.
You can use the notifications in integrated third-party apps, for example:

  • to collect data for data warehousing
  • to integrate with other software or services, such as billing and CRM
  • to integrate with additional marketing apps

How to use webhooks

When you subscribe 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:

  1. Create a webhook target. Specify the callback URL of your destination app that will receive incoming notifications. The endpoint returns a target ID.
  2. 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.
  3. 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.

Webhook endpoints

Webhook targets

Your webhook target will be your callback URL. You can use your webhook target and webhook filter to create a subscription.

👍

URL requirements

  • Use only secure URLs that start with HTTPS
  • URLs can have a maximum length of 2048 characters
  • URLs must conform to RFC 2396

Webhook filters

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.

Webhook subscriptions

Your webhook subscription lets you subscribe to events and provides a target for the callback.

Webhook events

The following webhook events are available:

Webhook event name

Trigger

sms.customer.subscribed

Triggered when a user subscribes to SMS

sms.customer.unsubscribed

Triggered when a user unsubscribes from SMS

sms.customer.asdded-to-list

Triggered when a subscriber is added to a list

sms.customer.removed-from-list

Triggered when a subscriber is removed from a list

Webhook object structure

Once you've successfully created a webhook, objects are returned according to the event_name created.

{
   "first_name":"Tom",
   "last_name":"Smith",
   "phone":"+14155552671",
   "email":"[email protected]",
   "external_id":"12312",
   "default_currency":"USD",
   "account_status":"disabled",
   "gender":"male",
   "address": {
      "address1": "96 Coffee Street",
      "address2": "",
      "city": "Hudson",
      "company": "null",
      "state": "New York",
      "zip": "13420",
      "province_code": "NY",
      "country_code": "US",
      "phone_number": "+5556251199"
   }
   "accepts_sms_marketing":true,
   "accepts_email_marketing":true,
   "sms_subscription_source":"Subscription form",
   "email_subscription_source":"",
   "tags":"vip, gold",
   "lists":[
      123
   ],
   "timezone":"",
   "created_at":"2020-09-08T08:43:27Z",
   "timestamp":1640014192
}
{
   "first_name":"Tom",
   "last_name":"Smith",
   "phone":"+14155552671",
   "email":"[email protected]",
   "external_id":"12312",
   "default_currency":"USD",
   "account_status":"disabled",
   "gender":"male",
     "address": {
      "address1": "96 Coffee Street",
      "address2": "",
      "city": "Hudson",
      "company": "null",
      "state": "New York",
      "zip": "13420",
      "province_code": "NY",
      "country_code": "US",
      "phone_number": "+5556251199"
   }
   "accepts_sms_marketing":true,
   "accepts_email_marketing":false,
   "sms_subscription_source":"Subscription form",
   "email_subscription_source":"",
   "tags":"vip, gold",
   "lists":[
      123
   ],
   "timezone":"",
   "created_at":"2020-09-08T08:43:27Z",
   "timestamp":1640014192
}
{
   "first_name":"Tom",
   "last_name":"Smith",
   "phone":"+14155552671",
   "email":"[email protected]",
   "external_id":"12312",
   "default_currency":"USD",
   "account_status":"disabled",
   "gender":"male",
   "address": {
      "address1": "96 Coffee Street",
      "address2": "",
      "city": "Hudson",
      "company": "null",
      "state": "New York",
      "zip": "13420",
      "province_code": "NY",
      "country_code": "US",
      "phone_number": "+5556251199"
   }
   "accepts_sms_marketing":true,
   "accepts_email_marketing":false,
   "sms_subscription_source":"Subscription form",
   "email_subscription_source":"",
   "tags":"vip, gold",
   "lists":[
      123
   ],
   "timezone":"",
   "created_at":"2020-09-08T08:43:27Z",
   "updated_list_id":123,
   "timestamp":1640014285
}
{
   "first_name":"Tom",
   "last_name":"Smith",
   "phone":"+14155552671",
   "email":"[email protected]",
   "external_id":"12312",
   "default_currency":"USD",
   "account_status":"disabled",
   "gender":"male",
   "address": {
      "address1": "96 Coffee Street",
      "address2": "",
      "city": "Hudson",
      "company": "null",
      "state": "New York",
      "zip": "13420",
      "province_code": "NY",
      "country_code": "US",
      "phone_number": "+5556251199"
   }
   "accepts_sms_marketing":true,
   "accepts_email_marketing":false,
   "sms_subscription_source":"Subscription form",
   "email_subscription_source":"",
     "tags":"vip, gold",
   "lists":[
      123
   ],
   "timezone":"",
   "created_at":"2020-09-08T08:43:27Z",
   "updated_list_id":123,
   "timestamp":1640014285
}

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.
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.