This article explains what a webhook is, the steps to set up it up as an action in the journey, and the data that'll be sent via the webhook
What is a webhook?
- A webhook is a way for an app (like Mailmodo) to provide other applications with real-time information. The webhook will make an HTTP request to your app (typically a POST)
- For example, when a contact gets enrolled into a journey by submitting a form, you can choose to send a webhook with form submission data.
Steps to send webhook as an action in Journey
Step 1: Drag and drop the Webhook card from Actions in the left panel.
Step 2: Connect it to the relevant card in the journey as per your requirement
Step 3: Click on the Webhook card which will open a right panel for setting up the webhook
Configuring a webhook
- Mailmodo needs a URL to deliver requests to. This means you need to set up a URL accessible from the public web. This is usually done through a backend panel or an API
- Mailmodo will POST data to you as JSON
We currently support webhook URLs that do not require any headers or URL parameters. The support for URLs with headers will be added soon.
Step 4: Add the URL you've configured in the Enter Webhook URL field and Click Save
Step 5: That's it! Your webhook URL will be called everytime a contact goes through the webhook card in the journey
What will be the data sent in the webhook?
The data sent in the webhook depends on the cards added preceding the webhook card. Please find below the list of scenarios and the data that'll be sent for each.
1. Specific contacts trigger → Webhook
{
"triggerData": {
"data": {},
"triggerSource": "CsvList",
"email": "gou****@mailmodo.com",
"triggerDetails": "file:1a69df39-****-4e0b-8b5c-73776157aa37/7647792f-4ebc-4f9d-ac79-05fb0356137e",
"userId": "d3775892-****-4f2f-b9d5-e49810eb2cae",
"journeyId": "1a69df39-****-4e0b-8b5c-73776157aa37",
"eventProperty": {}
}
}
2. Contact added to list trigger → Webhook
{
"triggerData": {
"data": {},
"triggerSource": "Manual Add To List",
"email": "gou****@mailmodo.com",
"userId": "d3775892-****-4f2f-b9d5-e49810eb2cae",
"journeyId": "349e986e-f56c-****-bc3b-b5f13c3e34da",
"eventProperty": {}
}
}
3. Change in property of a contact trigger → Webhook
{
"triggerData": {
"data": {},
"triggerSource": "Dashboard-change in property: first_name",
"email": "gou****@mailmodo.com",
"userId": "cc56708d-****-****-8c07-a4bfa5a7b79b",
"journeyId": "a78d7221-de34-47d8-81c6-5ad70cf4ee38",
"eventProperty": {}
}
}
4. Form submission trigger→ Webhook
{
"triggerData": {
"data": {},
"formSubmissionData": {
"element6ehxt3": "Te**",
"element6jkcy4": "Bang****",
"fuuid": "47949",
"next-step-id": "step7tr7n2",
"total-steps": "3",
"responseId": "4a8bfda7-****-4a8c-9cd1-a30d30a6dab9",
"recipientEmail": "gou****@mailmodo.com",
"formId": "formmqxnu2",
"recordedAt": {
"ts": 1657097786,
"date": "2022-07-06",
"hour": 14,
"minute": 26
},
"submissionSource": "amp"
},
"email": "gou****@mailmodo.com",
"triggerSource": "form submission",
"userId": "11bff3e8-****-4e93-a533-fd8f9defc768",
"journeyId": "03664747-****-412e-8790-de9e9abe96a5",
"eventProperty": {}
}
}
5. Occurrence of an event trigger→ Webhook
{
"triggerData": {
"data": {},
"eventProperty": {
"Name": "APPLE iPhone 13 (Blue, 128 GB)",
"Category": "Mobiles",
"Is Purchased": "false",
"Price": "829",
"Currency": "USD"
},
"triggerSource": "New Custom Event Trigger - Product Viewed",
"email": "gou****@mailmodo.com",
"userId": "d3775892-****-4f2f-b9d5-e49810eb2cae",
"journeyId": "3f135bf7-****-4e31-b265-f61cfe1bd423"
}
}
6. Webhook/API trigger → Webhook
{
"triggerData": {
"email": "gou****@mailmodo.com",
"data": {},
"userId": "d3775892-****-4f2f-b9d5-e49810eb2cae",
"journeyId": "b1ee6bf6-****-4b5a-b7b5-0637853cd8c3",
"triggerSource": "Api",
"eventProperty": {}
}
}
7. Specific contacts trigger→ Send campaign → Opened condition → Webhook
{
"eventData": {
"type": "html"
},
"triggerData": {
"data": {},
"triggerSource": "CsvList",
"email": "gou****@mailmodo.com",
"triggerDetails": "file:5d31c2b4-****-4a84-acd3-834cae80231b/5a61e0b8-b6f6-4d7d-abf2-90357d6638af",
"userId": "cc56708d-****-4fea-8c07-a4bfa5a7b79b",
"journeyId": "5d31c2b4-****-4a84-acd3-834cae80231b",
"eventProperty": {}
},
"lastCampaignEmailRef": "064c76e7-****-4780-a001-226c066aaa12",
"lastCampaignId": "31422f76-****-4a72-a630-dd6f9f615bc3"
}