简体   繁体   English

MailChimp API 3.0批量/批量订阅

[英]MailChimp API 3.0 batch/bulk subscribe

For MailChimp API 2.0 there was a method 'batch-subscribe', to send in an array of email addresses to be added to a specific list in MailChimp. 对于MailChimp API 2.0,有一种“批量订阅”方法,用于发送要添加到MailChimp中特定列表的电子邮件地址数组。
How to implement this in the new Rest Architecture based MailChimp API 3.0? 如何在新的基于Rest体系结构的MailChimp API 3.0中实现这一点?
See https://github.com/mailchimp/APIv3-examples/wiki/Overview 参见https://github.com/mailchimp/APIv3-examples/wiki/概述
It says it would work with array of objects 它说它将与对象数组一起使用
But by the schema it only accepts an object 但是通过模式,它只接受一个对象
Schema https://us9.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json 架构https://us9.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json

MailChimp API v3.0 is now live! MailChimp API v3.0现已发布! and they've also added a better batch operations feature which lets you make multiple operations in just one call. 他们还增加了更好的批处理功能,使您可以在一个呼叫中进行多个操作。 You can use below code with the help of this php wrapper for MailChimp apiV3 for the batch operations. 您可以在MailChimp apiV3的此php包装程序的帮助下使用以下代码进行批处理操作。

    $data1 =array(
            'email_address' => 'testingmail1@gmail.com',
            'status' => 'subscribed',
            'merge_fields' => array('FNAME' => 'Testing', 'LNAME' => 'Mail1'));
    $data2 =
        array(
            'email_address' => 'testingmail2@example.com',
            'status' => 'subscribed',
            'merge_fields' => array('FNAME' => 'Testing', 'LNAME' => 'Mail2'));
    $attributes = array(
        'operations' => array(
            array(
                'path' => 'lists/' . $listID . '/members',
                'method' => 'POST',
                'body' => json_encode($data1)
            ),
            array(
                'path' => 'lists/' . $listID . '/members',
                'method' => 'POST',
                'body' => json_encode($data2)
            ),
        ));

    $response = $MailChimp->post('batches/', $attributes);

The page you're linking to look like docs from the beta, but either way, they say that batch operations aren't yet implemented. 您链接的页面看起来像Beta版中的文档,但是无论哪种方式,他们都说尚未执行批处理操作。 FWIW, the real docs also list Batch Operations as a part of the roadmap , so I doubt they're done yet. FWIW,真正的文档也将批处理操作列为路线图的一部分,因此我怀疑它们是否已经完成。

This is not an issue at the Mailchimp end. 在Mailchimp端,这不是问题。 You just need to use arrays and objects properly. 您只需要正确使用数组和对象即可。

Good batch subscribe example you can find here https://rudrastyh.com/wordpress/wp-users-to-mailchimp-list.html#batch_subscribe_php 好的批量订阅示例,您可以在这里找到https://rudrastyh.com/wordpress/wp-users-to-mailchimp-list.html#batch_subscribe_php

Yeah. 是的 It was an issue at the Mailchimp end. 在Mailchimp端,这是一个问题。 We reported it and they got it fixed in a day or so. 我们报告了这个问题,他们在一天左右的时间内就解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM