Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Language issue #52

Open
gaboratorium opened this issue Apr 28, 2016 · 1 comment
Open

Template Language issue #52

gaboratorium opened this issue Apr 28, 2016 · 1 comment

Comments

@gaboratorium
Copy link

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?

@wulfsolter
Copy link
Collaborator

Is there an error returned from Mailchimp? There may be more to the error obj than just

{
  message: ....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants