Email sending API for Product Cart Emails

Mailmodo's transactional API can be used to dynamically send a product catalogue to the users with a Purchase option inside the email itself. The product can be personalized for individual users at the time of sending the emails.

A cart can be of two types:

  1. Single product cart - It can be simply used to show recommended products or offers. Users can purchase that particular product
  2. Dynamic Cart - A user can leave one or more products in the cart. To show all the products in one cart along with the total price, the data need to be sent through an API

1. Creating a Single Product Cart

Steps

  1. Create a template with a product block. Our e-commerce sample template could be a good starting point. If a specific design is required, our team can code a custom block as well.
  2. Personalize the parts of the template e.g. Product Name, Price, Description etc.
  3. Create a campaign using the template, choose Send on Trigger option while selecting the contact list.
  4. Once the campaign is created, the personalization parameters and trigger endpoint is available in the integration tab of the campaign.
  5. These details can be used to send the email on any kind of trigger

Integration with Website or Other tools

The endpoint for the campaign can work as a webhook for sending action-based emails from other tools like MoEngage, WebEngage or Clevertap. It can also be used to send emails on user activity events such as registration or cart drop. Here is an example of integrating CleverTap.

Endpoint

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:

  1. Subject is optional, if not provided, the original subject set in the campaign will be used
  2. 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, here is the perfect grill from your family",

"email": "user@example.com",

"data":{

"firstName" : "John",

"userId" : "U123",

"product_name" : "The Super Grill",

"product_price" : "$300.00",

"product_description" : "The perfect size to grill up a couple of burgers for everyone in the family"

}

}'

Sample axios

var axios = require('axios');

var data = JSON.stringify(

{"subject":"Hi, here is the perfect grill from your family",

"email":"user@example.com",

"data":{

"firstName" : "John",

"userId" : "U123",

"product_name" : "The Super Grill",

"product_price" : "$300.00",

"product_description" : "The perfect size to grill up a couple of burgers for everyone in the family"

}

});

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);

});

2. Dynamic product catalogue and cart abandonment

The dynamic catalogue allows showing the user dynamic products based on an API every time the user opens the email.

Steps:

  1. Create a template with a dynamic product widget. It’s only available in V2 templates. Please contact us if it’s not enabled in your account.
  2. Personalize the parts of the template e.g. Product Name, Price, Description etc.
  3. Provide the Endpoint Url that will be used to fetch the catalogue. It can be optionally personalized to provide the cart id. This URL must return an array of objects containing the above keys.
  4. Create a campaign using the template, choose Send on Trigger option while selecting the contact list.
  5. Once the campaign is created, the personalization parameters and trigger endpoint is available in the integration tab of the campaign.
  6. These details can be used to send the email on any kind of trigger
  7. Every time a user opens the email the Endpoint Url will be fetched and the user will be shown products based on the response.

Sample Personalization data

"data":{

"firstName" : "John",

"userId" : "U123",

"cartId" : "C876"

}

Sample Catalog endpoint response

"data":[{

"product_name" : "The Super Grill",

"product_price" : "$300.00",

"product_description" : "The perfect size to grill up a couple of burgers for everyone in the family" ,

"Quantity" : 1

},

{

"product_name" : "The ultimate skewers",

"product_price" : "$5.00",

"product_description" : "The perfect companion for your grill",

"Quantity" : 8

}]

]

Did this answer your question?