Bob*_*Ray 4 php segment mailchimp mailchimp-api-v3.0
使用MailChimp API V3.0创建活动.
我想创建一个发送给具有特定兴趣的用户的广告系列.看起来这在文档中是可行的,但我已经尝试了我能想到的每一种排列.只要我省略了segment_ops成员,我就可以创建广告系列.有没有人有PHP代码的例子呢?
由于您在通过API设置用户兴趣时未包含兴趣类别,因此似乎奇怪地处理了兴趣.我不确定这会如何影响广告系列的制作.
Bob*_*Ray 16
我已经得到了这个工作,虽然你无法从当前的文档中获得它,这些文档没有列出'兴趣'condition_type或者可能的'op'值.
兴趣必须按兴趣类别分组(在UI的某些部分称为"组").
以下是recipients数组的segment_opts成员的JSON:
"segment_opts": {
"match": "any",
"conditions": [{
"condition_type": "Interests",
"field": "interests-31f7aec0ec",
"op": "interestcontains",
"value": ["a9014571b8", "5e824ac953"]
}]
}
Run Code Online (Sandbox Code Playgroud)
这是带有注释的PHP数组版本.'match'成员引用'条件'数组中的规则.该段可以匹配任何,所有或任何条件.此示例只有一个条件,但其他条件可以作为附加数组添加到'conditions'数组中:
$segment_opts = array(
'match' => 'any', // or 'all' or 'none'
'conditions' => array (
array(
'condition_type' => 'Interests', // note capital I
'field' => 'interests-31f7aec0ec', // ID of interest category
// This ID is tricky: it is
// the string "interests-" +
// the ID of interest category
// that you get from MailChimp
// API (31f7aec0ec)
'op' => 'interestcontains', // or interestcontainsall, interestcontainsnone
'value' => array (
'a9014571b8', // ID of interest in that category
'5e824ac953' // ID of another interest in that category
)
)
)
);
Run Code Online (Sandbox Code Playgroud)