如何通过 API 在 MailChimp 模板中设置可编辑图像

How to set editable image in MailChimp template via API

我制作了一个带有可编辑图像的模板 ("Editable Content Area"),如下所示:

<img src="http://somewhere.com/foo.jpg" mc:edit="header_image">

制作新广告系列时,我可以在使用 MailChimp 编辑器的同时替换图片。但我似乎无法使用 API. 替换图像。

如果我将 URL 作为部分内容添加到图像中,它似乎会被忽略,并且会在未设置新图像 url 的情况下创建广告系列。

    content: {
      sections: {
        header_image: "http://somewhere/else/bar.jpg",
        header: "Our latest newsletter",
        body: "<p>My fabulous content</p>",
        ... other named mc:edit section content ...
      }
    }

正在正确替换所有其他可编辑部分(文本)。

问题:如何通过campaigns/create API设置mc:edit标记图像的url?

不幸的是,MailChimp API 不支持可编辑的内容区域。可编辑区域是为在他们自己的编辑器中使用而制作的。

解决方法是只拥有一个可编辑的内容区域,并通过 API 将完整的图像标签放入其中。

例如;

content: {
  sections: {
    header_image: "<img src='http://somewhere.com/foo.jpg'>",
    header: "Our latest newsletter",
    body: "<p>My fabulous content</p>",
    ... other named mc:edit section content ...
  }
}