Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Mandrill not recognize my merge tags?

I am using the Mandrill API and have a simple template:

<html>
    <body>
        <p>Hello *|name|* 
        </p>
    </body>
</html>

And am using the send-template.json API from here: https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template

And when i insert my payload then the 'name' var is still not populated, any idea why?

{
    "key": "secret",
    "template_name": "mandrill-sunday",
    "template_content": [
        {
            "name": "example name"
        }
    ],
    "message": {
        "html": "<p>Example HTML content</p>",
        "text": "Example text content",
        "subject": "example subject",
        "from_email": "[email protected]",
        "from_name": "Example Name",
        "to": [
            {
                "email": "[email protected]",
                "name": "Recipient Name"
            }
        ],
        "headers": {
            "Reply-To": "[email protected]"
        },
        "important": false,
        "track_opens": null,
        "track_clicks": null,
        "auto_text": null,
        "auto_html": null,
        "inline_css": null,
        "url_strip_qs": null,
        "preserve_recipients": null,
        "bcc_address": "[email protected]",
        "tracking_domain": null,
        "signing_domain": null,
        "merge": true,
        "global_merge_vars": [
            {
                "name": "merge1"
            }
        ],
        "merge_vars": [
            {
                "rcpt": "[email protected]",
                "vars": [
                    {
                        "name": "merge2"
                    }
                ]
            }
        ],
        "tags": [
            "password-resets"
        ],
        "google_analytics_domains": [
            "mydomain.com"
        ],
        "google_analytics_campaign": "mandrill-sunday",
        "metadata": {
            "website": "www.mydomain.com"
        },
        "recipient_metadata": [
            {
                "rcpt": "[email protected]",
                "values": {
                    "user_id": 123456
                }
            }
        ]
    },
    "async": false
}

But the only thing i get back in my email sent is:

Hello *|name|*
like image 993
Kamilski81 Avatar asked Jun 23 '13 18:06

Kamilski81


People also ask

Why is Mailchimp merge tag not working?

If it still seems like merge tags aren't working, try to send a test email to yourself or a small test segment. Be sure your test email accounts have default values for each merge value in your campaign, and segment your audience to send to only these test addresses.

Do merge tags work in test emails?

Merge tag values won't populate in test emails. Try sending a full live campaign to yourself or enter preview mode in the campaign builder and click the "Enable live merge tag info" slider to test them out.

How do I link a merge tag in Mailchimp?

Add link ID merge tag to your emailNavigate to the Content section of the campaign builder and click Edit Design. Add a link to your content. In the URL, include the merge tag for the unique identifier field from your audience.


1 Answers

Because each replacement requires two fields: its name and its contents. So your merge should become something like:

"vars": [
  {
     "name": "name",
     "content" : "merge2"
  }
]
like image 127
Palantir Avatar answered Sep 24 '22 06:09

Palantir