6

MailChimp API V3.0 を使用してキャンペーンを作成します。

特定の関心を持つユーザーに送信するキャンペーンを作成したいと考えています。これはドキュメントで可能であるように見えますが、考えられるすべての順列を試しました。segment_ops メンバーを除外する限り、キャンペーンをうまく作成できます。それを行うPHPコードの例はありますか?

API を介してユーザーの興味を設定するときに、interest-category を含めていないため、興味の扱いがおかしいようです。これがキャンペーンの作成にどのように影響するかはわかりません。

4

2 に答える 2

19

私はこれを機能させました.API定義はここにあります https://us1.api.mailchimp.com/schema/3.0/Segments/Merge/InterestSegment.json

インタレストは、インタレスト カテゴリ (UI の一部では「グループ」と呼ばれます) の下にグループ化する必要があります。

受信者配列の segment_opts メンバーの JSON は次のとおりです。

 "segment_opts": {
        "match": "any",
        "conditions": [{
            "condition_type": "Interests",
            "field": "interests-31f7aec0ec",
            "op": "interestcontains",
            "value": ["a9014571b8", "5e824ac953"]
        }]
 }

これは、コメント付きの PHP 配列バージョンです。「一致」メンバーは、「条件」の配列内のルールを参照します。セグメントは、条件のいずれかに一致するか、すべてに一致するか、いずれにも一致しません。この例には 1 つの条件しかありませんが、他の条件は「条件」配列に追加の配列として追加できます。

$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
        )
    )

  )
);
于 2016-03-05T04:44:12.457 に答える