Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch Subscibe/Unsubscribe using MailChimp API v3.0

I am building an SSIS package to communicate with the Mailchimp API and batch subscribe/unsubscribe emails to certain lists. The calls are sent fine and the job is started, every response I sent returns an error with a message of

<email> is already a list member.  Use PUT to insert or update list members

My problem is I am sending the request with a PUT Method, my sample call body is below.

{
    "operations": 
    [
        {
            "method": "PUT",
            "path":"lists/d09d88d1bd/members/71743C40CBFB64DC556CB4457DA012AE",
            "body":"{\"email_address\":\"email\",\"status\":\"unsubscribed\"}"
        }
    ]
}

I am getting the same error whether I make the API call straight from my SSIS package or if I use Postman REST Client.

like image 400
jeastham1993 Avatar asked Jun 16 '26 23:06

jeastham1993


1 Answers

I had the same issue as well and it was because I did not convert the email address to lowercase before applying md5 to get the subscriber_hash.

The update method takes a subscriber id which is the md5 hash of the lowercase version of the email address.

According to the documentation, subscriber_hash refers to 'The MD5 hash of the lowercase version of the list member’s email address.'

http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/

like image 129
jyek Avatar answered Jun 20 '26 11:06

jyek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!