问题描述
我的电子邮件模板包含一些介绍性文字,后跟可重复的块[图片+按钮].
My email template has some intro text followed by a repeatable block [a picture + a button].
我想将此块重复X次,每次都用新链接更新图片链接和按钮链接.
I would like to repeat this block some X times and each time have picture link and button link updated with new links.
当前,我正在使用此有效负载来编辑一个块,并且它按预期工作.我已使用此SO答案作为指南.
Currently I am using this payload to edit one block, and it is working as intended. I have used this SO answer as a guideline.
var data = {
'template': {
'id': template_id,
'sections': {
'editbutton': '<a class="mcnButton " title="Get Profile" href="' + button1 + '" target="_blank" style="font-weight: bold;letter-spacing: normal;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;">GET DATA</a>',
'editimage': '<img alt="" src="' + image1 + '" width="564" style="max-width:564px; padding-bottom: 0; display: inline !important; vertical-align: bottom;" class="mcnImage">'
}
}
};
我正在苦苦挣扎的是重复此块并更新图像和按钮链接.
What I am struggling is repeating this block and updating image and button link.
我正在使用Google Apps脚本,但是我想问题是语言的独立性.
I am working in Google Apps Script but I guess the problem is independence of language.
任何帮助将不胜感激.谢谢.
Any help would be appreciated.Thanks.
推荐答案
我认为您根本不需要使用mc:repeatable
或mc:variant
.使用单个mc:edit="editbutton_and_editimage_items_list"
MailChimp标签.通过发送到API的有效载荷的sections
部分,将包含实际数据的动态生成的HTML <ul><li>
列表放在此处.
I do not think you need to use the mc:repeatable
or the mc:variant
at all. Use the single mc:edit="editbutton_and_editimage_items_list"
MailChimp tag. Put there dynamically generated HTML <ul><li>
list with your actual data via sections
part of the payload you sent to the API.
例如您上面的var data = {..}
对象中的sections.editbutton_and_editimage_items_list
JSON项如下所示:
E.g. your sections.editbutton_and_editimage_items_list
JSON item in your var data = {..}
object above would look like:
<ul>
<li>
<a class="mcnButton " href="' + button1 + '" style="...">GET DATA</a></li>
<img alt="" src="' + image1 + '" width="564" style="..." class="mcnImage">
</li>
<!-- Repeat the LI with different data as needed --!>
</ul>
使用上述数据成功设置尚未发送的广告系列的模板内容后,请使用API发送广告系列.
After you successfully set the template content of your yet-not-sent campaign with the data above, use the API to send the campaign.
这篇关于MailChimp API-动态内容-mc:可重复+ mc:编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!