Email sending API
End point
https://api.mailmodo.com/api/v1/triggerCampaign/<campaign id>
This url can be obtained from the Integration tab.
Go to Dashboard -> Select the campaign from the list -> Integration
API key
Set header mmApiKey: <api key value>
Api key can be obtained from API Keys tab in Settings
Go to Settings -> API Keys
Request
Note:
- The Subject is optional, if not provided, the original subject set in the campaign will be used
- Campaign Id can be provided in the url path or in the payload with ‘campaignId’ key
Sample CURL
curl --location --request POST 'https://api.mailmodo.com/api/v1/triggerCampaign/<campaign id>' \
--header 'mmApiKey: <api key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"subject":"Hi, this email is from api trigger",
"email": "userexample@email.com",
"data":{
"firstName" : "John"
}
}'
Sample axios
var axios = require('axios');
var data = JSON.stringify(
{"subject":"Hi, this email is from api trigger",
"email":"userexample@email.com",
"data":{"firstName":"John"}});
var config = {
method: 'post',
url: 'https://api.mailmodo.com/api/v1/triggerCampaign/<campaign id>',
headers: {
'mmApiKey': '<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);
});