0

I am trying to sync a person record from my DB to mailchimp. I can update all fields except email. Email i can update only once. On updating again it throws an error. I am using their java API. This is what i am doing -

emailType = "";
replaceInterests = false; 

mergeVars.put("EMAIL", rs.getString("email"));

Boolean rc = mcServices.listUpdateMember(apiKey, listId, mailChimpId, mergeVars, emailType, replaceInterests);

The error message on reupdating is -

com.nwire.mailchimp.MailChimpServiceException: oldEmail@email.com is not a member of listName at com.nwire.mailchimp.MailChimpServiceFactory$ClientFactory$1.invoke(MailChimpServiceFactory.java:190) at $Proxy0.listUpdateMember(Unknown Source) at com.nwire.mailchimp.test.TestMCList1.updateDetails(TestMCList1.java:121) at com.nwire.mailchimp.test.TestMCList1.sync(TestMCList1.java:92) at com.nwire.mailchimp.test.TestMCList1.run(TestMCList1.java:52) at com.nwire.mailchimp.test.TestMCList1.main(TestMCList1.java:35)

Please note, oldEmail@email.com in the error message is the original email address in Mailchimp shich i have successfully updated once, but still shows up on reupdations.

Thanks

gaurav
  • 1
  • 1
  • 1

2 Answers2

0

Along with the old email address ie

mergeVars.put("EMAIL", email);

you define the new one in the following way:

mergeVars.put("NEW-EMAIL", new-email);

So you need both the old and the new addresses in orer to update it

WooDzu
  • 4,771
  • 6
  • 31
  • 61
  • Although in my case I'm using PHP you should not use both EMAIL and NEW-EMAIL at the same time. The "old email" is by the "email_address" key, and then you can either use merge_vars['EMAIL'] or merge_vars['NEW-EMAIL'] to update the subscriber address. My understanding of your answer is that you have to have both, [which is incorrect](https://twitter.com/MailChimp_API/status/351674145609748480). – alexleonard Jul 05 '13 at 01:44
0

I'm really not sure what you are using as mailChimpId, but this is the email as well. So, if the email changes, this variable should change as well. In your case it will look like this:

String email = rs.getString("email");
mergeVars.put("EMAIL", email);
Boolean rc = mcServices.listUpdateMember(apiKey, listId, email, mergeVars, emailType, replaceInterests);

I hope this helps (I wrote this Java wrapper and this works just fine on my server).

zvikico
  • 9,765
  • 4
  • 38
  • 49
  • Thanks .. But i don't think this works. Because how will Mailchimp know which contact's email has to be changed (we are just passing the updated email, not the email stored with mailchimp). I am using mailchimpId - unique id assigned by mailchimp to each contact. – gaurav Nov 10 '10 at 22:42
  • I would suggest using the MailChimp API support group. http://groups.google.com/group/mailchimp-api-discuss. You can also email their support. – zvikico Nov 11 '10 at 05:29