首页 文章

MailChimp API - 动态内容 - mc:repeatable mc:edit

提问于
浏览
0

我的电子邮件模板有一些介绍文本,后跟一个可重复的块[图片一个按钮] .

我想重复这个块X次,每次都用新的链接更新图片链接和按钮链接 .

目前我正在使用此有效负载编辑一个块,它正在按预期工作 . 我使用this SO answer作为指导 .

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">'
                                      }
                         }
             };

我正在努力的是重复这个块并更新图像和按钮链接 .

我正在使用Google Apps脚本,但我猜问题是语言的独立性 .

任何帮助,将不胜感激 . 谢谢 .

1 回答

  • 1

    我认为你根本不需要使用 mc:repeatablemc:variant . 使用单个 mc:edit="editbutton_and_editimage_items_list" MailChimp标记 . 通过 sections 发送到API的有效负载的一部分,将动态生成的HTML <ul><li> 列表与您的实际数据放在一起 .

    例如 . 上面的 var data = {..} 对象中的 sections.editbutton_and_editimage_items_list JSON项看起来像:

    <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发送广告系列 .

相关问题