Journey building involves 2 steps:
1. Creating the journey

2. Selecting the recipient audience. This can be done through-

- sending to a contact list

- uploading a new CSV list

- using an API trigger

For setting up a journey through an API trigger:

  1. Configure the journey. Then in the journey page, click on 'Start Journey', and select 'API Description'. A similar tab will open:

StartApi and AbortApi contain the following parameters:

StartApi

Endpoint: https://api.mailmodo.com/hooks/start/<journey id> (this will be used to trigger the particular journey every time a user-defined action occurs)

API key: Api key can be obtained from API Keys tab in Settings

Go to Settings -> API Keys

Request:

Sample CURL

curl --location --request POST 
'https://api.mailmodo.com/hooks/start/<journey id>' \
--header 'mmApiKey: <MAILMODO_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "email for journey",
"data": {
"personalisation_param1": "value 1",
"personalisation_param2": "value 2"
}
}'

Sample Axios

var axios = require('axios');
var data = JSON.stringify({
email: 'email for journey',
data: { personalisation_param1: 'value 1' },
});
var config = {
method: 'post',
url: 'https://api.mailmodo.com/hooks/start/<journey id>',
headers: { mmapikey: 'MAILMODO_API_KEY', 'Content-Type': 'application/json' },
data: data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});


personalization parameters: to be passed in the 'data' in the form of a 'key-value' pair. These are meant to assign values to personalization used in the subject line/ body of the mail. For eg. {"firstName" : "John" }

AbortApi

You may need to abort/terminate a running journey on a particular event (eg. customer completes a CTA) or after a fixed time (if set in journey). You can use the Abortapi below to do that-

Endpoint: https://api.mailmodo.com/hooks/abort/<journey id>

API key: Api key can be obtained from API Keys tab in Settings

Go to Settings -> API Keys

Request:

Sample CURL

curl --location --request POST 
'https://api.mailmodo.com/hooks/abort/<journey id>' \
--header 'mmApiKey: <MAILMODO_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "email to be aborted",
"reason":"reason to abort"
}'

Sample Axios

var axios = require('axios');
var data = JSON.stringify({ email: 'email to be aborted', reason: 'reason to abort' });
var config = {
method: 'post',
url: 'https://api.mailmodo.com/hooks/abort/<journey id>',
headers: { mmapikey: 'MAILMODO_API_KEY', 'Content-Type': 'application/json' },
data: data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Did this answer your question?