It looks like you don't have the merge_vars
, merge
, and global_merge_vars
parameters within the message
. They should be nested in the message
to take effect. So it would look something like this:
{
"key": "xxxyyyzzz",
"template_name": "coupon-purchased",
"template_content": [],
"message": {
"to": [
{
"email": "xxx@yyy.com"
}
],
"merge": true,
"global_merge_vars": [
{
"name": "FNAME",
"content": "Your name"
},
{
"name": "FGYMNAME",
"content": "Your gym"
}
],
"merge_vars": [
{
"rcpt": "xxx@yyy.com",
"vars": [
{
"name": "FNAME",
"content": "Your name"
},
{
"name": "FGYMNAME",
"content": "Your gym"
}
]
}
]
}
}
The Mandrill API docs also have JSON examples, which you can use for comparison. Here's a link to the JSON for the messages/send-template: https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template