gpt4 book ai didi

mailchimp - 将事件发送到分割

转载 作者:行者123 更新时间:2023-12-02 02:11:15 26 4
gpt4 key购买 nike

有人知道如何将事件发送到分割市场吗?此代码无效。它将向事件中的所有人发送一封电子邮件。它不会使用该段。 (这是一些更多的文本,所以我可以让它通过 SO 的验证。)

我的代码:

    //get member list
$memberArray = $api->listMembers($inStockListId);
foreach ($memberArray['data'] as $member) {
$memberInfo = $api->listMemberInfo($inStockListId, $member['email']);
$_productId = $memberInfo['data'][0]['merges']['PRODUCTID'];

$productId='34';
if ($productId == $_productId) {
array_push($emailArray, $member['email']);
}
}

//create new segment for campaign
$listStaticSegmentId = $api->listStaticSegmentAdd($inStockListId, 'inStockStaticSegment');

//add members to segment
$val = $api->listStaticSegmentMembersAdd($inStockListId, $listStaticSegmentId, $emailArray);

$conditions = array();
$conditions[] = array(
'field' => 'email',
'op' => 'like',
'value' => '%'
);
$segment_options = array(
'match' => 'all',
'conditions' => $conditions
);

$type = 'regular';
$options = array(
'template_id' => $campaignTemplateId,
'list_id' => $inStockListId,
'subject' => 'In-Stock Notification',
'from_email' => 'from@email.com',
'from_name' => 'My From Name'
);
$content = array(
'html_main' => 'some pretty html content',
'html_sidecolumn' => 'this goes in a side column',
'html_header' => 'this gets placed in the header',
'html_footer' => 'the footer with an *|UNSUB|* message',
'text' => 'text content text content *|UNSUB|*'
);

$newCampaignId = $api->campaignCreate($type, $options, $content, $segment_options);

最佳答案

我想通了。本质上,这是流程。如果您需要详细的代码,请给我发消息,我很乐意提供帮助。

$api = new MCAPI($this->_apiKey);
$api->listMemberInfo($this->_listId, $member['email']);
$api->listUpdateMember($this->_listId, $member['email'], $mergeVars);
$api->listStaticSegmentDel($this->_listId, $segment['id']);
$api->listStaticSegmentAdd($this->_listId, $segmentName);
$api->listStaticSegmentMembersAdd($this->_listId, $segmentId, $emailArray);
$api->campaignCreate($type, $options, $content, $segment_options);
//$api->campaignSendTest($newCampaignId, array($member['email']));
$api->campaignSendNow($newCampaignId);

请注意,这是通过 MailChimp PHP API 完成的。

关于mailchimp - 将事件发送到分割,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12679506/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com