php - How to mail to a static list segment with mailchimp API -
once i've identified identified email addresses of list segment (using get_emails()
custom function, setting list segment follows:
$batch = get_emails(); //now create list segment: $api->liststaticsegmentadd(wedding_list_id, 'new_wedding_guests'); $api->liststaticsegmentmembersadd(wedding_list_id, 'new_wedding_guests', $batch); //do build vars campaign? $options = array ( 'list_id' => wedding_list_id, //what value id's list segment? 'subject' => 'alpha testing.', 'from_email' => 'wedding@juicywatermelon.com', 'from_name' => 'pam & kellzo', 'to_name' => $account->name, );
from here can use basic campaign , send it?
$content['text'] = "some text."; $content['html'] = get_link($account); $cid = $api->campaigncreate('regular', $options, $content); $result = $api->campaignsendnow($cid);
i'm not sure if i'm understanding api documentation correctly. tried 'list_id' => 'new_wedding_guests';
failed create campaign.
thanks!
i'll assume test code , make cursory mention of how don't need creating new static segment every time. however, call add members not going work. per liststaticsegmentmembersadd documentation, should passing static segment id
, not name of it. note docs cross-reference when input params can come other calls - parameter there example (it happens returned liststaticsegmentadd).
your options campaigncreate start. documentation has examples below - examples included in php mcapi wrapper downloaded. per above, list_id
need 1 list used in liststaticsegment calls (also linked in documentation).
now real key - further down in campaigncreate docs segment_opts
parameter - how control segmentation. follow link gives you , you'll find tons of info on ways can segmentation, including using static_segment
.
hopefully of made sense, if not, take step , check out these links (and play segmentation in app), should:
Comments
Post a Comment