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.
3. Create an Event Flow
- Create an event flow (under Design -> Events)
- Specify the Conditions (event types that you'll need to be pushed)
- Add the template created in step 1 to the Event Flow Steps
- Add an ExternalData (read more on ExternalData) Flowstep to the Event Flow Steps
- 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:
4. Test
An easy way to test and view what data is sent to the endpoint is using https://webhook.site/ as endpoint.