Event Flows (Pushing Message Events to your Webhook)

In order to push message_events to your webhook endpoint, you can follow these steps:

 

1. Create a Template

Create a template Event to JSON under Design -> Templates:

 

Description: Event to JSON

Type: JSON data

Edit: Add the code below

<#if event??>
<#assign archive = fetchMessageArchive(event.message.id) />
</#if>
${toJson(.main)}

Create template!

 

2. Setup your (default) Flow

Do you wish to report opens or clicks? Make sure to activate those Flowsteps in the flow before setting up your Event Flow. Otherwise these events will not be reported.

 

flowsteps normal flow voor event.jpg

 

3. Create an Event Flow

  1. Create an event flow (under Design -> Events)
  2. Specify the Conditions (event types that you'll need to be pushed)
  3. Add the template created in step 1 to the Event Flow Steps
  4. Add an ExternalData (read more on ExternalData) Flowstep to the Event Flow Steps
  5. In the Flowstep, add URL (the webhook to POST to):
    • Format: Auto-detect
    • Under Advanced, add the following:
      • Request Method: POST
      • Header name: Content-Type
      • Header value: application/json
      • Request body: 
        ${toJson(event)}

 

The Event Flow should look as follows:

afbeelding

 

4. Test

An easy way to test and view what data is sent to the endpoint is using https://webhook.site/ as endpoint.