I am attempting to use the API in PHP to subscribe and assign a subscriber to a group.
I need to be able to create the group on the fly and I'm trying something like the following with not much success:
// include other relevant files here
$merge_vars = array(
'FNAME'=>$name[0],
'LNAME'=>$name[1],
'INTERESTS'=>'',
'GROUPINGS'=>'Pets'
);
If I remove the 'groupings' from the Array, the subscribing works just fine - so we've got that going... but how do we do groups?
Thanks for your time
I know this is a little late, but I figured this might help someone else.
$merge_vars = array(
'GROUPINGS' => array(
0 => array(
'id' => "101", //You have to find the number via the API
'groups' => "Interest Name 1, Interest Name 2",
)
)
);
And then you can use the listUpdateMember()
method to add an existing subscriber to an interest group.
// Then use listUpdateMember to add them
$objMailChimp->listUpdateMember($listID, $email, $merge_vars));
Add 1 more thing in array ie "EMAIL" => "test@test.com"
& when you calling listSubscribe() check your
apiKey, listId,
"email id which is to be add in subscriber list comes here ie test@test.com", EMAIL_TYPE fields properly.
try this. It will be helpful for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.