【问题标题】:How can I create a mailchimp campaign using tags?如何使用标签创建 mailchimp 活动?
【发布时间】:2019-10-20 04:15:29
【问题描述】:

我想通过过滤我已应用于预期子集的标签 ('test_tag') 上的列表来为电子邮件列表的子集创建一个 mailchimp 活动。我不确定正确的语法是什么。我找不到任何关于如何使用标签以编程方式创建任何东西的文档。

我可以使用“prebuilt_segment_id”功能成功地通过电子邮件发送我的列表子集。我创建了一个名为“test_segment”的片段。

以下代码有效:

curl --request POST \
--url 'https://us18.api.mailchimp.com/3.0/campaigns' \
--user 'anystring:12345667889qwerty' \
--header 'content-type: application/json' \
--data '{"recipients":{"list_id":"123abc", "segment_opts":{"prebuilt_segment_id":"test_segment"}},"type":"regular","settings":{"subject_line":"Your Purchase Receipt", "reply_to":"orders@mammothhouse.com","from_name":"Customer Service"}}' \
--include

使用我的标签“test_tag”而不是我的段的语法是什么(假设“test_segment”中的每个成员都有“test_tag”的标签)?

以下代码不起作用:

curl --request POST \
--url 'https://us18.api.mailchimp.com/3.0/campaigns' \
--user 'anystring:12345667889qwerty' \
--header 'content-type: application/json' \
--data '{"recipients":{"list_id":"123abc", "segment_opts":{"conditions":[ { "condition_type":"Tag", "field":"tag", "op":"is", "value":"test_tag" }]},"type":"regular","settings":{"subject_line":"Your Purchase Receipt", "reply_to":"orders@mammothhouse.com","from_name":"Customer Service"}}' \
--include

对此的任何帮助或使用标签创建使用 api 的任何示例将不胜感激(例如,我可以使用标签创建片段吗?)

【问题讨论】:

    标签: mailchimp mailchimp-api-v3.0


    【解决方案1】:

    根据Mailchimp(参见 StaticSegment),StaticSegments 现在是 Tags,因此以下是创建 conditions 数组的正确方法你想按标签分割:

        'conditions' => [
            [
              'condition_type' => 'StaticSegment',
              'field' => 'static_segment',
              'op' => 'static_is',
              'value' => $tagId
            ]
         ]
    

    请记住,您需要提前获取标签 ID 才能使其正常工作。文档中有关于如何操作的 API。

    【讨论】:

      猜你喜欢
      • 2015-10-04
      • 2011-05-07
      • 2011-09-17
      • 2020-09-21
      • 2015-12-01
      • 2018-12-03
      • 2018-05-08
      • 2016-12-22
      • 2015-09-19
      相关资源
      最近更新 更多