Contacts can be imported in Mailmodo from your software stack via API. Using this API you can add contacts to a list without sending an email. The list will be available at Mailmodo portal so that you can send them ad-hoc emails. Numbers, Booleans, Strings and Dates (in UNIX or ISO 8601) are supported inside the data object.

This article is a guide on the API request structure to do the same:

API Gateway URL:

The Mailmodo API Gateway URL is https://api.mailmodo.com/ You need to include this before each API endpoint to make API requests.

API End point:

https://api.mailmodo.com/api/v1/addToList

API Authorization:

Mailmodo APIs are completely RESTful. All Mailmodo APIs are authorised via an API key.

Generate API Key:

  1. Login to your Mailmodo account with appropriate credentials.

  2. Navigate to SettingsAPI KeysShow API Key to view the default API key. (You may also create a new API Key by clicking on the 'Add new API Key' button)

Request

Header:

'mmApiKey': '<api key value>'

'Content-Type': 'application/json'

Body: Post the necessary fields for the API to create a new user.

Parameters:


email

  • Required field

  • Email address of the contact to be added


data

  • Optional personalisation fields in key-value pairs. ex-
    "First Name": "Daniel"


listName

  • Required field

  • Name of the list to which the contact to be added. If the list does not exist, it will be created

Response

Parameters:

success

true/false

message

"The contact is successfully added/updated"

Sample Requests:

Sample CURL

curl --location --request POST 'https://api.mailmodo.com/api/v1/addToList' \ --header 'mmApiKey: <api key>' \ --header 'Content-Type: application/json' \ --data-raw '{ "email": "john@example.com", "data":{"firstName" : "John"}, "listName":"test" }'

Sample axios

var axios = require('axios'); var data = JSON.stringify( {
"email":"john@example.com", "data":{"firstName":"John"}, "listName":"test" });
var config = { method: 'post', url: 'https://api.mailmodo.com/api/v1/addToList', 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); });

Response:

response is received in the following JSON format:

{ "success": true, "message": "The contact is successfully added/updated" }