APIs are an important part of our connected workflows. They let you connect multiple apps and help them ‘talk’ to each other. Similarly, connecting your API to Mailmodo helps you build complex workflows by connecting various apps. Sending an AMP email campaign may be one of your favorite options because of the high conversion rates it provides.
This guide will detail the exact steps you need to follow to trigger AMP emails through your API in Mailmodo.
Table of contents
Benefits of using APIs with Mailmodo
Honestly, there are an impressive number of benefits of connecting your API to Mailmodo. But to keep things short, here are some important ones:
Integrate third-party apps and tools.
Trigger automated email campaigns from third-party apps.
Set trigger endpoints for journey emails.
Perform all these tasks with minimal steps.
Even if you are new to APIs and want to use them, there's no need to worry. This guide has a step-by-step guide to help you trigger AMP emails in Mailmodo using APIs. But before that, we’ve to talk about API endpoints.
What are API Endpoints?
Endpoints are used for interacting with server-side web APIs, as they specify where resources lie that can be accessed by third-party software. Usually, the access is via a URL to which HTTP requests are posted and from which the response is expected.
Simply put, API Endpoints help you get your apps to communicate with each other.
How to send AMP emails from Rest API using Mailmodo
Creating a POST request
Following are the parameters that you will need to create a POST request.
Endpoint
You can get the trigger endpoint URL from the corresponding Transactional Campaign in the following format:
https://api.mailmodo.com/api/v1/triggerCampaign/
You will get this URL on enabling a transactional campaign. You can also obtain this URL for any campaign by following this path: Mailmodo Dashboard > Go to 'Transactional' tab > Select the required campaign > Trigger Info.
API key
An application programming interface key (API key) is a unique identifier used to authenticate a user, developer, or calling program to an API.
You can get API keys from Mailmodo using the following path: Mailmodo Dashboard > Go to 'Settings' tab > API Keys.
You need to provide the API key with the header 'mmApiKey' in the following format: mmApiKey:
Request
POST requests can be generated in multiple ways.
Here are sample CURL and axios request.
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": "apurv.gpt@gmail.com",
"data":{
"firstName" : "John",
}
}
Sample axios
var axios = require('axios');
var data = JSON.stringify(
{"subject":"Hi, this email is from api trigger",
"email":"apurv.gpt@gmail.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);
});
Personalization parameters:
You need to make the required personalizations in the parameters before using these. These have to be passed in the 'data' in the form of a 'key-value' pair and are meant to assign values to personalization used in the subject line/ body of the mail.
For eg. {"firstName" : "John"}
💡 Important notes
'Subject' is optional and if not provided, the original subject set in the campaign will be used.
Campaign Id can be provided in the URL path or the payload with the ‘campaignId’ key.
Wrap up
Mailmodo is an A - Z email marketing solution that you can rely on and increase your conversion rates significantly just like our users. Mailmodo is also a pioneer in AMP emails and we are continuously pushing the boundary by creating interesting features like spin the wheel.
Check out our definitive guide on AMP emails if you want to have an in-depth understanding of all things AMP. One of the best ways to know if something work is by trying it out. So sign up for Mailmodo today to take full advantage of AMP emails!
What you should do next
Hey there, thanks for reading till the end. Here are 3 ways we can help you grow your business:
Talk to an email expert. Need someone to take your email marketing to the next level? Mailmodo’s experts are here for you. Schedule a 30-minute email consultation. Don’t worry, it’s on the house. Book a meet here.
Send emails that bring higher conversions. Mailmodo is an ESP that helps you to create and send app-like interactive emails with forms, carts, calendars, games, and other widgets for higher conversions. Get started for free.
Get smarter with our email resources. Explore all our knowledge base here and learn about email marketing, marketing strategies, best practices, growth hacks, case studies, templates, and more. Access guides here.