Skip to content

Template Language issue #52

Description

@gaborpinterweb

I successfully connected to my MailChimp account and managed to create a new campaign. The scenario would be that every time I create a new 'newsboard' in my application I create a MailChimp Campaign using a template and the content of the newsboard. I am trying to use MailChimp Template Language for this: http://templates.mailchimp.com/getting-started/template-language/

var optionsObj = {
                 list_id: 'xxx',
                 subject: 'xxx',
                 from_email: 'xxx',
                 from_name: 'xxx',
                 template_id: 'xxx',
                 to_name: 'xxx',
             };

             var contentObj = {
                 sections: {
                     "header": 'Test Header title!',
                     "header2": 'Test Header title 2!',
                     "date": 'Test Date'
                 }
             };

             //Mailchimp call
             api.call('campaigns', 'create', { type: 'regular', options: optionsObj, content: contentObj }, function(error, data) {
                 if (error)
                     console.log(error.message);
                 else
                     console.log(JSON.stringify(data)); // Do something with your data!
                     //send it
             });

In the MailChimp Template editor I have the following HTML code:

<div mc:edit="header"> /* content */ </div>
<div mc:edit="header2"> /* content */ </div>
<div mc:edit="date"> /* content */ </div>

Is there another way to do this or get around, or am I doing something wrong?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions