Real-time export of event data via webhooks (Beta)

This topic is for administrators and developers with administration access rights in Episerver Campaign.

This topic describes how to manage webhooksHTTPS callback for sending event data in real time. using the REST API documentation on Episerver World to export event data in real time. As soon as a user performs an action, such as opens or clicks, you immediately receive the corresponding event data.

Using the Episerver Campaign REST API, you can create webhooks, retrieve webhook information, activate, deactivate and delete webhooks.

Creating a webhook

Prerequisite: You must set up the REST API in your client. See REST API on Episerver World.

  1. Open the operation Create a webhook and click Try it out.

    Image: Try it out

  2. Enter the following information in the corresponding mandatory fields:

    Image: Creating a webhook

  3. To create the webhook, click Execute. If the creation was successful, you receive the HTTP response status code 201.
  4. To retrieve information of the created webhooks, execute the operation Get information about all webhooks.

    Image: Get information about all webhooks

    You can find the following information in the Response body:

    • id. Webhook ID
    • type. Type of the event data
    • status. Webhook status
    • format. Data format of the event data
    • created. Creation date of the webhook
    • modified. Modification date of the webhook

    You need the webhook ID for activating, deactivating and deleting the webhook.

    Image: Response body

Activating a webhook

To export event data in real time, you must activate the corresponding webhook. Do the following:

  1. Open the operation Activate a webhook and click Try it out.

    Image: Activating a webhook

  2. Enter the following information in the corresponding mandatory fields:
  3. To activate the webhook, click Execute. If the activation was successful, you receive the HTTP response status code 200.

As soon as a mailing recipient performs an action, Episerver Campaign sends the corresponding event data via a HTTP POST request to the target URL. The event data is sent in batches 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.

Example of event data (opens) in JSON format:

{
  "type":"open",
  "recipientId":"123456789005",
  "userListId":123456789003,
  "remoteAddress":"0.0.0.0",
  "clientId":123456789001,
  "mailingId":123456789004,
  "created":1564590054000,
  "subscriptionId":1234567,
  "mailId":"3IHQ2XT8-38PY7WFQ-XKNQSY",
  "device":"desktop",
  "operatingSystem":"Windows 10",
  "browser":"Firefox 64.1"
}

Deactivating a webhook

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:

  1. Open the operation Dectivate a webhook and click Try it out.

    Image: Deactivating a webhook

  2. Enter the following information in the corresponding mandatory fields:
  3. To deactivate the webhook, click Execute.

Deleting a webhook

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.

  1. Open the operation Delete a webhook and click Try it out.

    Image: Deleting a webhook

  2. Enter the following information in the corresponding mandatory fields:
  3. To delete the webhook, click Execute.