Webhooks
To enable this feature, contact customer support.
This topic describes how to use webhooks to receive real-time event data about your mailings. You can create webhooks for the following events:
- sent mailings
- opens
- clicks
- bounces
- unsubscribes
- spam complaints
For example, you can use the data for notifications and analyses in external systems such as CRM software. You manage webhooks using the Optimizely Campaign REST API.
Creating webhooks
- Open the operation Create a webhook and click Try it out.
- Enter the following information in the corresponding mandatory fields:
- clientId. Client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- targetUrl. URL to which the event data is to be sent.
Prerequisites:
- URL must be accessible and able to receive data via HTTP POST requests from the IP address 193.169.180.1 at any time
- current HTTPS version and standard port 443 for HTTPS connections
- type. Type of the event data to be sent.
- open. Opened mailing.
- click. Clicked links.
- sent. Sent mailing.
- bounce. Generated hard or soft bounce.
- unsubscribe. Unsubscribed from newsletters. See also: Unsubscribers.
- spamcomplaint. Message marked as spam.
- format. Data format in which the event data is to be sent.
The following data format is currently available: JSON.
- Optionally, enter the following information if you want to submit the Basic HTTP Authentication header:
- basicAuthUsername. User name.
- basicAuthPassword. Password.
- Click Execute. If the creation was successful, you receive the HTTP response status code 201.
Retrieving webhook information
To retrieve information about a webhook, such as webhook ID, target URL, and event type, do the following:
- Open the operation Get information about all webhooks and click Try it out.
- In the clientId mandatory field, enter your client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- Click Execute.
You need the webhook ID for updating, verifying, activating, deactivating and deleting the webhook.
Updating webhooks
- Open the operation Update a webhook and click Try it out.
- Enter the following information in the corresponding mandatory fields:
- clientID. Your client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- webhookId. Webhook ID. You can retrieve the webhook ID with the operation Get information about all webhooks.
- Update the information as described in Creating webhooks.
- Click Execute. If the update was successful, you receive the HTTP response status code 200.
Verifying webhooks
To verify that the webhook is ready to use and can send event data to the specified URL, do the following:
- Open the operation Verify a webhook and click Try it out.
- Enter the following information:
- clientID. Your client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- webhookId. Webhook ID. You can retrieve the webhook ID with the operation Get information about all webhooks.
- mailinId. ID of a valid mailing, for example a test mailing in Smart Campaigns.
- Click Execute. If the verification was successful, you receive the HTTP response status code 200.
Activating webhooks
To export event data in real time, you must activate the corresponding webhook. Do the following:
- Open the operation Activate a webhook and click Try it out.
- Enter the following information in the corresponding mandatory fields:
- clientID. Your client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- webhookId. Webhook ID. You can retrieve the webhook ID with the operation Get information about all webhooks.
- Click Execute. If the activation was successful, you receive the HTTP response status code 200.
Event data
As soon as a mailing recipient performs an action, Optimizely Campaign sends the corresponding event data via a HTTP POST request to the target URL. The event data is sent in batches (lists) consisting of a maximum of 100 events each.
After successful data receiving, the target URL must return the HTTP response status code 200. Otherwise the export is retried every 10 seconds. If no data can be delivered three days after the event is created, the event is discarded.
Deactivating webhooks
If you no longer want to export event data, you must deactivate the webhook. The webhook still exists and you can reactivate it later. Do the following:
- Open the operation Dectivate a webhook and click Try it out.
- Enter the following information in the corresponding mandatory fields:
- clientID. Your client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- webhookId. Webhook ID. You can retrieve the webhook ID with the operation Get information about all webhooks.
- Click Execute.
Deleting webhooks
For example, if you no longer need a webhook or want to create new webhooks, but the creation limit per client is reached, you can delete webhooks. Do the following:
You can only delete deactivated webhooks. See Deactivating a webhook.
- Open the operation Delete a webhook and click Try it out.
- Enter the following information in the corresponding mandatory fields:
- clientID. Your client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API Overview > REST API.
- webhookId. Webhook ID. You can retrieve the webhook ID with the operation Get information about all webhooks.
- Click Execute.