This is a Mandrill to SparkPost email template migration tool. It enables translation of Mandrill's Handlebars syntax into equivalent SparkPost Template Language syntax.
It can migrate templates directly from your Mandrill account to SparkPost using the simple UI. It can also translate Mandrill template content directly into its SparkPost equivalent.
If you want to automate your migration, the tool also has an API.
See below for details on deployment, Heroku deployment.
- Basic Handlebars syntax: variables, logic, iteration
- Logic and iteration:
if
,each
- Mandrillisms:
elseif
, backtick conditionals`x < 10`
- Inline helpers:
upper
,lower
andtitle
are accepted but ignored - MailChimp merge tags:
*|variable_name|*
- HTML escaping: please put your markup in your template
- Inline helpers:
url
,data
,striptags
- Block helpers:
unless
,with
Deploy it locally or on another environment using the instructions below.
- node 8
- npm 6
git clone --recursive https://github.com/SparkPost/mandrill-sparkpost-templates.git
cd mandrill-sparkpost-templates
npm install
npm start
You now have a server running on port 3000
.
You can also deploy it directly to Heroku:
Once deployed, you can migrate templates between services or translate template content directly
through the UI hosted on port 3000
.
If you prefer direct API access to automate your template migration, here's how the API endpoints work:
Accepts a Mandrill template and converts it to SparkPost format.
Request:
POST /api/translate HTTP/1.1
Content-Type: application/json
{
"mandrillTemplate": "..."
}
Successful response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"sparkPostTemplate": "..."
}
Extracts a template from Mandrill, translates it and imports it into SparkPost. Your SparkPost API key must include Templates Read/Write
permission in order to add templates to your account. Manage your API keys from the API Keys page(EU).
Request:
POST /api/migrate HTTP/1.1
Content-Type: application/json
{
"mandrillAPIKey": "...",
"mandrillTemplateName": "...",
"sparkPostAPIKey": "..."
}
Successful response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"result": true
}
On error the API endpoints will return a non-200 status code and a JSON error object containing a list of errors:
{
"errors": [
{"message": "Description of a thing that did not work."},
{"message": "..."}
]
}
We welcome your contributions. Check out our contributor notes for details on how to help out.