使用 mailChimp API 创建营销活动时定位特定群体
我似乎无法弄清楚如何使用 mailChimp API 发送到我的列表中的组
我的代码如下所示:
$conditions = array('field'=>'interests-1', 'op'=>'all', 'value'=>'myGroup');
$opts = array('match'=>'any', 'conditions'=>$conditions);
$retval = $api->campaignSegmentTest($listId, $opts);
但这会产生 bool(false)。当我的列表获取时,
$retval = $api->listInterestGroupings($listId);
看起来像这样:
array(1) {
[0]=>
array(5) {
["id"]=>
int(1)
["name"]=>
string(10) "myList"
["form_field"]=>
string(5) "radio"
["display_order"]=>
string(1) "0"
["groups"]=>
array(5) {
[0]=>
array(4) {
["bit"]=>
string(1) "1"
["name"]=>
string(9) "myGroup"
["display_order"]=>
string(1) "1"
["subscribers"]=>
int(1)
}
[1]=>
array(4) {
["bit"]=>
string(1) "2"
["name"]=>
string(9) "myGroup_2"
["display_order"]=>
string(1) "2"
["subscribers"]=>
int(1)
}
}
}
}
我查看了 API 文档并搜索了答案,但似乎无法弄清楚。感谢您的帮助!
I cannot seem to figure out how to send to a group in my list using mailChimp API
My code looks like this:
$conditions = array('field'=>'interests-1', 'op'=>'all', 'value'=>'myGroup');
$opts = array('match'=>'any', 'conditions'=>$conditions);
$retval = $api->campaignSegmentTest($listId, $opts);
But this yields bool(false). When fetched by
$retval = $api->listInterestGroupings($listId);
my list looks like this:
array(1) {
[0]=>
array(5) {
["id"]=>
int(1)
["name"]=>
string(10) "myList"
["form_field"]=>
string(5) "radio"
["display_order"]=>
string(1) "0"
["groups"]=>
array(5) {
[0]=>
array(4) {
["bit"]=>
string(1) "1"
["name"]=>
string(9) "myGroup"
["display_order"]=>
string(1) "1"
["subscribers"]=>
int(1)
}
[1]=>
array(4) {
["bit"]=>
string(1) "2"
["name"]=>
string(9) "myGroup_2"
["display_order"]=>
string(1) "2"
["subscribers"]=>
int(1)
}
}
}
}
I have looked in the API documentation and searched for the answer, but cannot seem to figure it out. Grateful for help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在使用 PHP 包装器 - 首先要做的事情,就像它包含的示例一样,是在弄乱 $retval 之前通过查看 $api->errorCode 来检查是否有任何错误。
当您这样做时,我确信您会看到一个错误,告诉您尚未传递正确的“条件”参数,因为它是数组的数组,而不是数组。
Looks like you are using the PHP wrapper - the first thing to do, like the examples included with it do, is to check for any errors by looking at $api->errorCode before messing with the $retval.
When you do that I'm certain you will see an error telling you that you haven't passed a proper "conditions" parameter since it is an array of arrays, not an array.