I'm trying to use the MailChimp API to update an email address of a member when they change their email in our web app.
I'm using the Laravel MailChimp bundle and it's been working great (I can subscribe users, update groupings, update name etc), but I must have the merge_vars or something incorrect.
I use this:
$member_details = array(
// grabbed from config and working (also API key handled by bundle)
'id' => $id,
// passed from function - corresponds to the old email address
'email_address' => $mailchimp_old_email,
'merge_vars' => array(
// Old email again?
'EMAIL' => $mailchimp_old_email,
// new email address
'NEW-EMAIL' => $mailchimp_new_email,
),
'replace_interests' => FALSE,
);
$response = Mailchimp::listUpdateMember($member_details);
So "$response = 1", which made me think it had worked, but the user email has not changed when I view the subscriber list on MailChimp.
The 1.3 API docs have listSubscribe detailing the merge_vars "EMAIL" and "NEW-EMAIL" and I read about it on this stackoverflow post. I did try using listSubscribe again even though it was an existing member, but this failed with a $response saying the member is already subscribed.
Any recommendations on where I might be going wrong? I haven't found a clear example of this sort of listUpdateMember api usage.