Mailchimp API不替换mc:edit内容部分(使用ruby库) [英] Mailchimp API not replacing mc:edit content sections (using ruby library)
问题描述
我在用我提供的内容替换Mailchimp中的mc:edit
内容区域时遇到问题.
I'm having a problem replacing mc:edit
content areas in Mailchimp with the content that I provide.
电子邮件已发送给订户,但所提供的内容均未添加到电子邮件中.谁能看到我可能在哪里出问题了?
The email is sent out to the subscribers, but none of the content provided is added to the email. Can anyone see where I might be going wrong?
这是我正在使用的脚本:
This is the script that I am using:
campaign = mailchimp.campaigns.create(
"regular",
{
"list_id" => list_id,
"subject" => "Email Test",
"from_email" => "edward@somewhere.com",
"from_name" => "Edward",
"to_name" => "The to name",
"template_id" => 35089
},
{
"sections" =>
{
"commit_stuff" => "Modified project to use XYZ ruby gem. #ABC-123",
"content" => "This is the content",
"more-content" => "This is more content"
}
}
)
result = mailchimp.campaigns.send(campaign["id"])
这是我要修改的电子邮件中的部分:
And this is the section inside the email that I am trying to modify:
<div mc:edit="commit_stuff" class="mcnTextContent">Use your own custom HTML</div>
<div mc:edit="content"></div>
<div mc:edit="more-content"></div>
相关文档:
- API https://apidocs.mailchimp.com/api/2.0/campaigns/create.php
- 图书馆 http://www.rubydoc.info/gems/mailchimp-api/2.0.4/Mailchimp/Campaigns#create-instance_method
- API https://apidocs.mailchimp.com/api/2.0/campaigns/create.php
- Library http://www.rubydoc.info/gems/mailchimp-api/2.0.4/Mailchimp/Campaigns#create-instance_method
推荐答案
使用MailChimp中的模板管理器,我为此苦了几天.使它正常工作的唯一方法是导出现有模板,将mc:edit标记添加到代码中,然后将其作为自定义模板上传.
I struggled with this for a few days, using the template manager in MailChimp. The only way I got it to work was exporting my existing template, adding the mc:edit tag to the code and then uploading it as a custom template.
从MailChimp导出模板
- 转到模板"
- 单击要与API一起使用的模板旁边的编辑"下拉箭头
- 选择导出HTML"
将模板上传到MailChimp
- 转到模板"
- 点击右上角的创建模板"按钮
- 点击自行编写代码"
- 然后选择导入html"
我的模板代码示例:
<div mc:edit="eventmessage">
Custom Event Message (replaced by API Call)
<br></div>
作为检查,现在我可以看到使用/templates/info API调用
As a check, I was now able to see the section now appear when using /templates/info API call
一旦我确认Mailchimp看到了我使用/campaigns/create 调用的模板部分,如上所述,但跳过了html定义.
Once I confirmed that Mailchimp saw the template section I used /campaigns/create call, as mentioned above but skipping over the html definition.
更新的广告系列/创建(内容/部分)
Updated campaign/create (content/sections):
},
"content": {
"sections": {
"eventmessage": "Event Message Content"
},
},
这篇关于Mailchimp API不替换mc:edit内容部分(使用ruby库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!