Ben Sinclair
Ben Sinclair

Reputation: 3986

Updating a users email address in MailChimp API V3

I am running the following code (I've hidden ID's) to update a subscriber's email address in a MailChimp list:

$mailchimp->patch('lists/1234567/members/' . md5('[email protected]'), [
    'email_address' => '[email protected]',
    'status' => 'subscribed',
    'merge_fields' => array(
        'FNAME' => 'Ben',
        'LNAME' => 'Sinclair',
    ),
]);

It does not seem to work. I do not receive any errors, it just does nothing.

How do you update an email address in a MailChimp list using API V3?

Upvotes: 1

Views: 5654

Answers (2)

Antonios Hafez
Antonios Hafez

Reputation: 11

You can change the email address when you make the request

PUT https://usx.api.mailchimp.com/3.0/lists/{list_id}/members/{subscriber_hash}

and the body was this:

{"email_address": "[email protected]"}

$List = 123456;
$subscriber_hash = md5("[email protected]")
$data = array('email_address' => "[email protected]" );
$result = $mailchimp->put("lists/$List/members/$subscriber_hash", $data);

Upvotes: 1

juanjose_hg
juanjose_hg

Reputation: 176

http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#edit-patch_lists_list_id_members_subscriber_hash

Currently, the email address is a parameter (read only = false) in the PUT method (.../3.0/lists/{listId}/members/{md5}) that allows to change the email address of the subscriber.

I'm sending the new email in the body and MERGE0 (EMAIL) tag but using the md5 from the previous email. It is changing the email correctly.

Upvotes: 1

Related Questions