First steps
Events and Behaviour Tracking
User Data
- Email Builder Review
- Designing your email
- Creating a Synchronized Module
- Setting Responsivity
- Building Smart Containers
- Creating a Gmail Promotions Annotation
- Adding a Rollover Effect
- Adding a Background to an Email
- Adding Anchor Links
- Adding a Video to an Email
- Adding a Table to an Email
- Adding a Custom Font
- Adding Social Media Buttons
- Editing HTML and CSS
- Working with “Images” block
Omnichannel
Automation
Personalization
Analytics
Multilanguage Campaigns
Recommendations
API
Security and Compliance
Integration
Webhooks to Follow up Activities
Webhooks are user-defined HTTP callbacks. They are usually triggered by an event, such as a read message or launched welcome email series. Webhooks are a handy tool to follow up on events in real-time – when an event occurs, a request is sent to an external URL.
There are 2 options in our CDP to implement webhooks:
-
Configure an external URL for the account to follow up on user activities.
-
Set up customized requests in scenarios using a special Webhook block.
Webhooks to follow up activities
This functionality allows receiving information about all the activities of your contacts in real-time. The information is delivered as scheduled to the specified URL using POST requests as explained below.
For comparison/alternative, there is Public API. It is triggered when GET requests are sent from your side. Time intervals (3 months maximum) and parameters (email, status, and others) can be specified in the requests.
Using webhooks, you receive information about any user activities when:
- delivered
- delivery error
- read
- the recipient followed the link
- the recipient unsubscribed
- the recipient reported spam
messages are sent in any messaging channel.
How to configure webhooks for your account
Configure the URL on the server where you want to receive notifications and POST requests in JSON format.
Indicate that URL address in system's settings. To do that:
-
Log in to your account.
-
Click the caret next to your account name.
-
Choose Settings.
-
Choose the Laboratory item in the menu on the left side.
-
Enable the Webhooks slide button.
-
Click the caret of the Webhooks section.
-
Type in/paste your URL address into the Webhook address field.
-
Click the Save button.
Upon saving, a GET request is sent by the system to the URL address for testing. If an error is returned, then probably your server has blocked our request. The actual cause can be determined from the server error code. If the test has passed successfully, then the setting-up is complete.
After that, perform any action in your account. For example, send yourself an email message. In several minutes, a POST request is sent to the specified address with the information about the latest actions.
POST requests are sent in JSON format in case of any actions by users (sent email, opened message, click-through, or other).
If the webhook URL does not return the HTTP 200 response code then the attempt of the POST request is repeated with incremented intervals (1 minute, 2 minutes, 4 minutes, 8 minutes, and up to 1 request per hour). The following requests are postponed until the successful delivery of the first one and then they are delivered in their sequence.
List of possible parameters
Parameter | Type | Description |
---|---|---|
broadcastId | int | Broadcast ID |
workflowId | int | Workflow ID |
workflowBlockId | string | Workflow block ID |
sourceEventKey | string | Source event key |
sourceEventTypeKey | string | Source event type key |
iid | string | Service Parameter |
contactId | int | Contact ID |
string | Contact Email | |
sms | string | Contact phone number |
viber | string | Contact phone number |
mobilepush | string | Mobile app subscriber token |
webpush | string | Web push subscriber token |
activityStatus | string |
Activity status:
|
messageId | int | Message ID |
messageInstanceId | int | Message instance ID |
messageName | string | Message name (empty for test emails) |
messageTag | string | Message tag |
activityDateTime | string | Activity date and time |
statusDescription | string | This field is returned only in the event when the status is UNDELIVERED. It contains the reason why the message has been undelivered. This may be a recipient server response, a system response saying that message delivery was not possible, and other similar reasons. |
viewMessageLink | string | Contains the link to the message web-version |
clickEventLink | string | Contains the link clicked by a contact (when the status is CLICKED) |
hardBounce | bool |
This field is returned only in case when the status is UNDELIVERED. The parameter informs that the contact is in the black list. false – not in the black list at the moment of message delivery true – in the black list at the moment of message delivery |
statusData | Data array | |
subscripton | Data array | |
subscriptons | array of strings | Subscription category keys |
The test example of a webhook as JSON array with all possible status options:
[{
"iid": "ffd3e1a7-a270-4e58-94de-5ac681c5c8e7",
"contactId": 687266822,
"activityStatus": "SUBSCRIPTION_CHANGED",
"mediaType": "email",
"activityDateTime": "2019-09-26T14:45:18",
"statusData": {
"subscription": {
"subscriptions": [
"SMARTPHONES",
"TABLETS",
"LAPTOPS"
]
}
}
},
{
"broadcastId": 2833914,
"messageName": "promo",
"iid": "76662EBB-9FD4-4A6A-B1F8-2F594DF9B7B4",
"contactId": 295953704,
"email": "test@yourdomain.com",
"activityStatus": "DELIVERED",
"mediaType": "email",
"messageId": 976440,
"messageInstanceId": 1344540,
"activityDateTime": "2018-03-01T13:31:52",
"viewMessageLink": "https://123.esclick.me/test"
},
{
"broadcastId": 2833915,
"messageName": "promo",
"hardBounce": false,
"iid": "D5AF8EFC-2E8F-4BB5-B427-77D554B30E65",
"contactId": 357885291,
"sms": "380671234567",
"activityStatus": "UNDELIVERED",
"mediaType": "sms",
"activityDateTime": "2019-10-01T03:43:49",
"statusDescription": "IM_NO_MONEY"
},
{
"broadcastId": 2833914,
"messageName": "promo",
"hardBounce": false,
"iid": "76662EBB-9FD4-4A6A-B1F8-2F594DF9B7B4",
"contactId": 295953704,
"email": "test@yourdomain.com",
"activityStatus": "UNDELIVERED",
"mediaType": "email",
"messageId": 976440,
"messageInstanceId": 1344540,
"activityDateTime": "2018-03-01T13:31:58",
"statusDescription": "smtp;554 5.7.1 Spam message rejected; If this is not spam contact abuse",
"viewMessageLink": "https://123.esclick.me/test"
},
{
"workflowId": 245460,
"workflowBlockId": "e_e9e90420db06b64c157440cd60d0b73d",
"sourceEventKey": "1258810400",
"sourceEventTypeKey": "subscribeFromApi",
"iid": "0bb5e1dc-0d1b-4deb-948f-8cea4d8ef738",
"contactId": 1258810400,
"email": "test@gmail.com",
"activityStatus": "READ",
"mediaType": "email",
"messageId": 1235215,
"messageInstanceId": 1622691,
"messageName": "promo",
"messageTag": "1522397496",
"activityDateTime": "2018-05-15T04:05:53",
"viewMessageLink": "https://123.esclick.me/test"
},
{
"workflowId": 245460,
"workflowBlockId": "e_e9e90420db06b64c157440cd60d0b73d",
"sourceEventKey": "1258810400",
"sourceEventTypeKey": "subscribeFromApi",
"iid": "92227CB7-4EEF-4168-9EA5-43F3ED3559F8",
"contactId": 1258810400,
"email": "test@gmail.com",
"activityStatus": "UNSUBSCRIBED",
"mediaType": "email",
"messageId": 1166457,
"messageInstanceId": 1550164,
"messageName": "promo",
"messageTag": "1521722870",
"activityDateTime": "2018-05-15T09:56:40",
"viewMessageLink": "https://123.esclick.me/test"
},
{
"workflowId": 245460,
"workflowBlockId": "e_e9e90420db06b64c157440cd60d0b73d",
"sourceEventKey": "1258810400",
"sourceEventTypeKey": "subscribeFromApi",
"iid": "d08d1e15-ea92-4d5c-8dc9-6f750250a6ff",
"contactId": 1258810400,
"email": "test@gmail.com",
"activityStatus": "CLICKED",
"mediaType": "email",
"messageId": 1242672,
"messageInstanceId": 1630305,
"messageName": "promo",
"messageTag": "1522397496",
"activityDateTime": "2018-05-15T04:45:04",
"viewMessageLink": "https://123.esclick.me/test",
"clickEventLink": "https://test.ua/promo/"
},
{
"workflowId": 245460,
"workflowBlockId": "e_e9e90420db06b64c157440cd60d0b73d",
"sourceEventKey": "1258810400",
"sourceEventTypeKey": "subscribeFromApi",
"iid": "0ae4b6a3-59ad-426e-a40b-ce8f55bd40bc",
"contactId": 1258810400,
"email": "test@yahoo.com",
"activityStatus": "SPAM",
"mediaType": "email",
"messageId": 1242672,
"messageInstanceId": 1630305,
"messageName": "promo",
"messageTag": "1522397496",
"activityDateTime": "2018-05-15T08:23:56",
"viewMessageLink": "https://123.esclick.me/test"
}
]