如何使用 mailchimp API 邮寄到静态列表段

发布于 2024-11-06 11:27:22 字数 1140 浏览 0 评论 0原文

一旦我确定了我的列表分段的电子邮件地址(使用 get_emails() 自定义函数),我将按如下方式设置我的列表分段:

    $batch = get_emails();
    //now create my list segment:
    $api->listStaticSegmentAdd(WEDDING_LIST_ID, 'new_wedding_guests');
    $api->listStaticSegmentMembersAdd(WEDDING_LIST_ID, 'new_wedding_guests', $batch);
    //do I build vars for a campaign?
    $options = array (
      'list_id' => WEDDING_LIST_ID, //What value id's my list segment?
      'subject' => 'Alpha testing.',
      'from_email' => '[email protected]',
      'from_name' => 'Pam & Kellzo',
      'to_name' => $account->name,   
    );

从这里我可以使用基本营销活动并发送它吗?

    $content['text'] = "Some text.";
    $content['html'] = get_link($account);
    $cid = $api->campaignCreate('regular', $options, $content); 
    $result = $api->campaignSendNow($cid);

我不确定我是否正确理解了 api 文档。我也尝试了 'list_id' => 'new_wedding_guests'; 但未能创建活动,

谢谢!

Once I've identified identified the email addresses of my list segment (using get_emails() custom function, I am setting up my list segment as follows:

    $batch = get_emails();
    //now create my list segment:
    $api->listStaticSegmentAdd(WEDDING_LIST_ID, 'new_wedding_guests');
    $api->listStaticSegmentMembersAdd(WEDDING_LIST_ID, 'new_wedding_guests', $batch);
    //do I build vars for a campaign?
    $options = array (
      'list_id' => WEDDING_LIST_ID, //What value id's my list segment?
      'subject' => 'Alpha testing.',
      'from_email' => '[email protected]',
      'from_name' => 'Pam & Kellzo',
      'to_name' => $account->name,   
    );

From here can I use a basic campaign and send it?

    $content['text'] = "Some text.";
    $content['html'] = get_link($account);
    $cid = $api->campaignCreate('regular', $options, $content); 
    $result = $api->campaignSendNow($cid);

I'm not sure if I'm understanding the api documentation correctly. I also tried 'list_id' => 'new_wedding_guests'; which failed to create a campaign.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江心雾 2024-11-13 11:27:22

我假设这是测试代码,只是粗略地提到您可能不需要每次都创建一个新的静态段。但是,您添加成员的调用不会起作用。根据 listStaticSegmentMembersAdd 文档,您应该传递静态段 id< /code>,而不是它的名称。另请注意,当输入参数可以来自其他调用时,文档会交叉引用自身 - 该参数有一个很好的示例(它也恰好由 listStaticSegmentAdd)。

您的campaignCreate选项看起来是一个好的开始。它的 文档 包含以下示例 - 这些示例包含在 PHP MCAPI 包装器中你可能下载了。如上所述,您需要的 list_id 是您在 listStaticSegment 调用中使用的列表的 ID(也在文档中链接)。

现在真正的关键 - 在campaignCreate 文档的更下方是 segment_opts 参数 - 这就是您控制细分的方式。按照它为您提供的链接,您会找到大量有关方法的信息您可以进行分段,包括使用static_segment

希望所有这些都有意义,如果没有,请退后一步并查看这些链接(并在应用程序中使用分段),那么它应该:

MailChimp 列表管理简介

如何发送到列表中的某个部分?

我们关于如何使用静态段的发布信息

I'll assume this is test code and just make the cursory mention of how you probably don't need to be creating a new Static Segment every time. However, your call to add members is not going to work. Per the listStaticSegmentMembersAdd documentation, you should be passing the static segment id, not the name of it. Also note that the docs cross-reference themselves when input params can come from other calls - that parameter there is a good example (it also happens to be returned by listStaticSegmentAdd).

Your options for campaignCreate look like a good start. The documentation for it has examples below - those examples are included in the PHP MCAPI wrapper you likely downloaded. As per above, the list_id you need is the one for the list you used in the listStaticSegment calls (also linked in the documentation).

Now the real key - further down in the campaignCreate docs is the segment_opts parameter - that is how you control segmentation. Follow the link it gives you and you'll find tons of info on the ways you can do segmentation, including using a static_segment.

Hopefully all of that made sense, if not, take a step back and check out these links (and play with segmentation in the app), then it should:

Introduction to MailChimp List Management

How can I send to a segment of my list?

Our Release Info on how Static Segments are used

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文