The secret of deleting contacts from Constant Contact

You can’t really. An e-mail address in your Constant Contact account tells about your relationship with its owner, the contact. If a recipient becomes fed up with your newsletters and unsubscribes, this information must stick. You must not be allowed to simply delete the address and start over, pretending that nothing has happened.

When you “delete” an e-mail address or a contact using the CtCt website (called GUI) it’s actually only hidden, remaining in the database. It no longer counts towards your quota so for all practical purposes, we can call it deleted. Now, how do you do that with API?

First off, do NOT use what the documentation calls deleting an individual contact. You would not hide the contact from GUI – you would unsubscribe it (and it would even remain visible). There’s a huge difference between deleting/hiding and unsubscribing. A hidden contact can be brought back to the land of living and sent e-mails to, while an unsubscribed contact cannot – not without some mouse clicking from the contact himself. Definitely not in an automated way via API.

So if your goal is to give your user an option to subscribe to your newsletter from within your website, then to change his mind and unsubscribe – and then to change his mind again and subscribe back – do not use the DELETE method for deleting his CtCt contact because you wouldn’t be able to subscribe it back.

What you want to do instead, is called remove from all lists. Doing it via API is not the same thing as with the website so please bear in mind that I’m only talking about API now. When you remove a contact from all lists, its status is magically changed to REMOVED – both the contact’s and its e-mail address’ status will change. And guess what, it will actually disappear from the website, just as if you clicked More Actions / Delete on the CtCt website. Not very straight forward, is it.

before

  1. {
  2.   "id": "2009530238",
  3.   "status": "ACTIVE",
  4.   …
  5.   "email_addresses": [{
  6.     "id": "c099b9c0-38df-11e4-8148-d4ae5292c426",
  7.     "status": "ACTIVE",
  8.     …
  9.   }],
  10.   …
  11. }
  12.  

after

  1. {
  2.   "id": "2009530238",
  3.   "status": "REMOVED",
  4.   …
  5.   "email_addresses": [{
  6.     "id": "c099b9c0-38df-11e4-8148-d4ae5292c426",
  7.     "status": "REMOVED",
  8.     …
  9.   }],
  10.   …
  11. }
  12.  

To remove a contact from all lists, update it with an empty array for its lists property. The documentation is currently misleading when it says that lists require at least one list. Notice that it’s referring to method POST which is used for creating a new contact. Not for method PUT, used for updating.

You don’t have to worry about PUT/POST if you’re using the SDK. Simply call updateContact(). Or use deleteContactFromLists() which calls DELETE on an undocumented service https://api.constantcontact.com/v2/contacts/{contactId}/lists. These methods exist for both ConstantContact class and ContactService class.

Do you wonder what happens when you remove a contact from all lists using the website (GUI)? Nothing magical. Its status, and all its e-mail addresses’ status will remain ACTIVE.

Leave a Reply