Export mailchimp template to mandrill task with merge tags

I created the templates in Mailchimp and would like to export them to Mandrill, so it can be automated when a new user logs in to our website as a welcome email and โ€œget startedโ€ email.

In the Mailchimp template, I added mc:edit="name" in html as my mandril. JSON is looking for a name tag for personalization. Code below

 <p>Hi <span mc:edit="name">&nbsp;</span></p> 

When I send Mandrill and look at the source code, it ignores the mc: edit tag and shows it below

 <p>Hi <span></span></p> 

However, when I manually modify the mandrill template to enable mc: edit, personalization works.

Are there any settings I need to add to Mandrill (or Mailchimp) for this to work? It is very difficult to change the mandrill template all the time, because when we make changes to the mailchimp template, mc: edit becomes overridden as soon as I export it.

+5
source share
4 answers

In my MailChimp template, I use the following format to specify merge tags (name and product):

 <p>Hi *|name|*!</p> <p>Thanks for downloading *|product|*.</p> 

You will need to authorize MailChimp to access your Mandrill account. Assuming you have already done this, you are submitting your MailChimp template to Mandrill. You do this from the Templates page: click the Down arrow on the Edit button and select Send to Mandrill. You should now see your template in your Mandrill account at the Outbound โ†’ Templates page.

Assuming you want to send a new transactional message via Mandrill using the template, you will send the following JSON to https://mandrillapp.com/api/1.0/messages/send-template.json :

 { "key": "***apikey***", "template_name": "name-of-your-template", "template_content": [], "message": { "subject": "Thanks for downloading", "from_email": " hello@yourcompany.com ", "from_name": "yourcompany", "to": [ { "email": " john@theircompany.com ", "name": "John", "type": "to" } ], "merge": true, "merge_language": "mailchimp", "global_merge_vars": [ { "name": "name", "content": "John" }, { "name": "product", "content": "Awesome 1.0" } ] } } 
+4
source

So the answer is officially no. There is nothing that could be done to save the mc:edit areas in the exported templates: https://twitter.com/mandrillapp/status/617014296820580352 .

+2
source

The behavior you see indicates that you place the <span> inside another editable region. It's hard to say without seeing the full code. But, mc:edit areas saved when sent to Mandrill - this is what I can use the MailChimp template editor and send Mandrill, although it is limited to certain types of editable regions.

What you should work on, assuming the span is not nested inside another element with mc:edit declared.

But look at this example:

 <div mc:edit="body_text"> This is my sample body text with an <span mc:edit="editable_span">editable span</span> </div> 

It is not sent to Mandrill, because the mc:edit nested areas mc:edit not allowed in the MailChimp template language; when MailChimp exports the template, the insult to mc:edit will be removed. However, you should see that the mc:edit declaration in the <div> element is saved as expected.

If you want to do inline text replacement, it is better to use merge tags .

+2
source

still no workaround? This is so stupid, just one line of code in the mailchimp template builder, which is rejected by Mandrill. What is the point of sending it to mandrill if you cannot automatically embed html in the mail?

0
source

Source: https://habr.com/ru/post/1211905/


All Articles