cancel
Showing results for 
Search instead for 
Did you mean: 
Tonight (8/23) from 11:00 PM - 12:00AM ET we need to make a few updates to our site. During this time, no emails will be sent and some customers will not be able to access their contacts. We recommend finishing up your work before 11:00 PM and logging in after 12:00 AM ET. Thank you for your patience while we make these updates.

Adding Unsubscribe to my list again

Occasional Contributor

Adding Unsubscribe to my list again

Hi,

I have PHP script using API on our home page to add email  to our list to get 10% off next purchase. Everything seems to be working have (CURLINFO_HTTP_CODE)===409 which alert if the contact already exist. But a what if the customer is already unsubscribed before but  he or she wants to add his or her email to our list again to get the discount?

Thank you for your help

Dean

1 REPLY 1
Trusted Contributor

Re: Adding Unsubscribe to my list again

Hello Dean,

 

As you're talking about an integration using our API, we've moved your post to our developer support forum. A 409 repsonse from our API servers indicates that the email address you are attempting to add to the list has previously been added to the Constant Contact account. In our current data model, contacts are unique at the account level, and lists are attributes of the contact, rather than vice versa. Removing contacts doesn't remove the contact-account association, it merely changes their status. In order to add contacts who already exists in an account (even if removed or unsubscribed), based on HTTP standards, our API requires a different type of HTTP request than is used to create a new contact in an account.

 

To create new contacts, POST method requests are used, while PUT method requests must be used to update details (including list membership attributes). 

 

Typically, if you need a form that both creates new contacts in your account, and updates existing contacts, you would have one that

 

1) Checks to see if the contact exists (GET request to search for contact by email address).


2) If contact exists, you get the contact's full details (GET request on contact ID).

 

3) Update the contents of the contact's details, add in any new lists you want the contact to be on, without removing previous lists, and the update the contact (PUT request to update).

 

4) If in step 1, the contact is not found in the account, you simply create it (POST request).

 

There is a data security risk to allowing publicly accessible forms to be used to update contacts, in that anyone with one of your contact's email addresses could enter it in the form, and change any other details you include in your form. I could use your email address and change your name to "Fred Flintstone" (or something worse), and also subscribe you to recieve additional mailings potentially (potential SPAM complaints could result).

 

Let us know if you have additional questions. If you're using our PHP wrapper, or the CCSFG, there may be a some additional information or assistance we can provide you.

Mark Coleman
Support Engineer