I tried creating templates in MailChimp and then sending them out in a
campaign through the API. Everything seems to work okay except that
the email is mostly blank, with just the background color and an empty
grey rectangle in the middle. I went through Dashboard -> my
templates -> new template and chose the "Basic" template provided. I
tried sending just that, and I also tried editing the text and sending
that, but in both cases I got the same result. When building the
input request, I created a Dictionary<T> and did:
myDictionary.Add("html_header", "");
myDictionary.Add("html_main", "");
myDictionary.Add("html_footer", "");
I also ran the API wrapper provided and did the equivalent through the
web form, putting the three section names as "header", "main" and
"footer" in the textboxes (which appear when I select "template" from
the dropdown in the "Content" section). I tried putting "content_1",
"content_2" and "content_3" based on a reading of one of Jesse's posts
here, and I got the main body of the generic template to appear, but
not the header or the footer. I think I understand how things will
work for naming sections, but I cannot figure out how to see the code
for these templates that are created through the basic template
editor.
When I get a list of the templates I can look and see what the
sections are named, and they are indeed "html_header", "html_main" and
so on, so I think I am using the right names when I do the
CreateCampaign method. But nothing seems to work very well....and
when I used "content_1" that got some of the template to show up in
the email, the template information had no such section listed.
As an aside, in the future our company will have the sales force
creating templates so they cannot use the more complex raw HTML editor
in the Custom Template Builder. Is there a way to see and name (or
rename) these sections easily in the more friendly editor?
Thanks for any help,
Pete
The campaignTemplates() method will return all of the templates for
your account:
http://www.mailchimp.com/api/1.2/campaigntemplates.func.php
The "sections" will list out what should be passed back into the
campaignCreate() method. The other way is to go into your "my
templates" section in the web app, export the template, and see what
the name is set to in the mc:edit="xxx" field - those would be turned
into "html_xxx". If there's no name defined, that's when the content_X
section names will come into play, but I'd suggest naming them for
clarity. In that same area, you should can also edit the template code
so long as it is a custom, uploaded template. If you have something
based on one of our default templates, just export it, then import it
and it will be editable online. Of course then you'll also need to
make sure you are passing over the correct template id in the
campaignCreate() call.
It sounds like you must be using the PerceptiveMCAPI wrapper,
especially since I've never seen the web form you mentioned. I also
haven't used the wrapper, so I'm not sure if there's any "help" (like
auto-appending the "html_" portion) coming somewhere, but I kind of
doubt David would have done that since it would make referencing our
documentation more of a pain.
If that explanation doesn't help you get things straightened out, I
can test the problem template(s) if you send them to me (directly off
list), but from the sounds of it, I doubt I'll find an issue.
jesse
I was confused by looking at the help and the PerceptiveMCAPI wrapper,
and since the help did not say that the "content" object in the
campaignCreate() function was optional, I thought I had to put
something in there to tell the template what sections to use, but to
leave the actual content string blank so nothing would be
overwritten. So instead I just commented out that code to create and
add a Dictionary, letting "content" stay as the default, and my email
template came through fine. Just my confusion.
I think I see now how the sections should be added and edited....can
they be named anything? Or do they have to be "content_x"? I am
supposed to use it as either a placeholder in the template that I fill
in via the content tag from my API call, or overwrite text via the API
call, right?
Now I see that there is a little green arrow to export custom
templates, only when I roll over it. I spent a while trying to figure
that out!
The PerceptiveMCAPI wrapper that enables the user to enter sections
says not to use "html_" when entering a section name, as it is
automatically prepended. I am not sure if that is what you were
asking.
Thank you for pointing me in the right direction!
Pete
jesse
I think Pete was referring to the Testing UI that I provide.
In the UI, the form doesn't require the html_ to be entered, as it
prepends that to the name entered in the form before sending the
section name to the wrapper.
Using the wrapper in your own code, you follow the MailChimp Api
documentation, such that you -do- enter the section name value as
html_main, or what ever.
Confusing as hell? -- absolutely.
I'll be changing the UI in the next release to be consistent with the
wrapper (beta in a couple weeks).
... and after I get the beta out, I will be spending some time
improving the documentation -- it sure needs it.
Thanks,
David