【问题标题】:MailChimp API - dynamic content - mc:repeatable + mc:editMailChimp API - 动态内容 - mc:repeatable + mc:edit
【发布时间】:2019-05-10 13:53:28
【问题描述】:

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

我想重复这个块 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 脚本,但我想问题在于语言的独立性。

任何帮助将不胜感激。 谢谢。

【问题讨论】:

    标签: mailchimp mailchimp-api-v3.0


    【解决方案1】:

    我认为您根本不需要使用mc:repeatablemc:variant。使用单个 mc:edit="editbutton_and_editimage_items_list" MailChimp 标记。通过您发送到 API 的有效负载的 sections 部分将您的实际数据放入动态生成的 HTML &lt;ul&gt;&lt;li&gt; 列表。

    例如您在上面的 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​​发送活动。

    【讨论】:

    • 感谢您的帮助。我最终做到了这一点。我在图像 + 按钮上添加了 mc:edit。并使用您提到的部分对其进行了更新。
    • @urwaCFC,很高兴听到这个消息 :) 我有时所做的只是使用 MailChimp 列表作为电子邮件数据库的便捷存储,无需脑筋的双重选择并使用我自己的本地自定义电子邮件模板生成我需要的任何电子邮件。为了发送活动,我从 MC 获取订阅者列表,在我的服务器上生成电子邮件标记,然后通过 PHPMailer 发送。我还可以使用 SendGrid 事务电子邮件 API 而不是 PHPMailer,仍然在 MailChimp 中保留列表。后者允许统计活动,但它比 MC 的 Mandrill 便宜得多。
    猜你喜欢
    • 2021-11-16
    • 2023-03-10
    • 2021-03-21
    • 1970-01-01
    • 2014-12-22
    • 2023-03-12
    • 2014-12-06
    • 2018-08-06
    • 2015-01-29
    相关资源
    最近更新 更多