MailChimp API PHP - 加入兴趣小组 [英] MailChimp API PHP - Add to Interest Group
问题描述
我目前使用的MailChimp API的PHP版本1.3.1(http://apidocs.mailchimp.com/api/downloads/#php)
I'm currently using the MailChimp API for PHP, version 1.3.1 (http://apidocs.mailchimp.com/api/downloads/#php)
我已经成立了MailChimp列表,并想动态添加:
I've set up a list in MailChimp, and would like to dynamically add:
- 的订户名单(完成:
$ objMailChimp-> listBatchSubscribe($ strMailingListID,...)
) - 感兴趣的分组(完成:
$ objMailChimp-> listInterestGroupingAdd($ strMailingListID,...)
) - 兴趣团体到这些分组(完成:
$ objMailChimp-> listInterestGroupAdd($ strMailingListID,...)
) - 订户分配给相关组(未完成)
的API(http://apidocs.mailchimp.com/api/1.3/#listrelated)是如何将用户添加到一个利益集团有些不清楚 - 没有人在这里有任何想法
The API (http://apidocs.mailchimp.com/api/1.3/#listrelated) is somewhat unclear on how to add a subscriber to an interest group - does anyone here have any ideas?
干杯。
推荐答案
由于MailChimp的API的2.0版,这应该工作:
As of version 2.0 of MailChimp's API, this should work:
$merge_vars = array(
'GROUPINGS' => array(
array(
'name' => "GROUP CATEGORY #1", // You can use either 'name' or 'id' to identify the group
'groups' => array("GROUP NAME","GROUP NAME")
),
array(
'name' => "GROUP CATEGORY #2",
'groups' => array("GROUP NAME")
)
)
);
来源:<一个href=\"http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php\">http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php
使用PHP准系统包装( https://github.com/drewm/mailchimp-api/ )你然后可以通过发送这MailChimp或者列表/订阅或列表/批量订阅:
Using a barebones PHP wrapper (https://github.com/drewm/mailchimp-api/) you can then send this to MailChimp via either the lists/subscribe or lists/batch-subscribe:
$MailChimp = new MailChimp('API_KEY');
$result = $MailChimp->call('lists/subscribe', array(
'id' => 'LIST ID',
'email' => array('email'=>'trevor@example.com'),
'merge_vars' => $merge_vars
));
这篇关于MailChimp API PHP - 加入兴趣小组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!