Updating / Opting-in a Contact


Updating a Contact


To update a contact's information, the best way is to get details of an existing contact, modify the details, and use the resulting XML in a PUT method.  You will use the following URI to GET and PUT the contact.




The request body you use for a PUT must contain all elements that belong to a contact, which are returned through the GET method.  By using this XML, you should modify only the information you would like to update, then pass the XML in your request.


To modify the contact's subscriptions to different contact lists, you need to update contents of <ContactLists> element.  You must include all of the contact lists that the contact should be on.  Therefore, you should add the new list subscriptions to the existing lists in the XML returned by the GET.  



Opting in a Contact Who Was Unsubscribed


Contacts who have opted out of receiving all mails and have been placed on Do-Not-Mail list must opt themselves in.  The account owner cannot add a contact in Do-Not-Mail list back to a different list.  The action must be initiated by the contact.  When using the API, that means that the <OptInSource> must be ACTION_BY_CONTACT, which can only be used when the API call is the direct result of an action performed by the contact (e.g. clicking a Subscribe button in an application). It is a serious violation of the Constant Contact Terms of Service to use the Opt-in features of the API in any other way (i.e. opting in a contact without his or her action and consent).


In order to opt-in a contact, you must take the contact's detail data and modify <ContactLists> to include the contact contact lists in which the contact is signing up.  You also need to add an OptInSource node at the contact level with a value of ACTION_BY_CONTACT.  Then, you use the PUT method to apply the change against the contact resource:




Below is the format of the XML to opt-in a contact.  It adds the OptInSource node at the Contact level (as opposed to only being at the List level in a GET).


<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom">
  <link href="/ws/customers/joesflowers/contacts/2249" rel="edit" />
  <title type="text">Contact: joe@example.com</title>
    <name>Constant Contact</name>
  <content type="application/vnd.ctct+xml">
    <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/contacts/2249">
      <Name>Customer Joe</Name>
      <CountryName>United States</CountryName>
        <ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/lists/1" rel="self" />
    <title type="text">Contacts for Customer: joesflowers</title>
    <link href="contacts" />
    <link href="contacts" rel="self" />


Community Knowledge Base

Learning & Resources

We take questions asked by customers on the Community and expand on them to help you find answers fast, getting you back to using Constant Contact's suite of amazing tools in no time.

Read More

  • Avatar

    Support Tips

    Social Media

    "There's a multitude of ways to engage your audience through us using your social platforms - via ads, social post metrics, email links, and more! " - Will

    See Article
  • Avatar

    Support Tips

    Call-To-Action Links

    "Target your most engaged contacts by creating a segment. Create a special offer or show your appreciation!" - Caitlin

    See Article
  • Avatar

    Support Tips

    Welcome Your Audience

    "Greet new contacts with one or more automated Welcome Emails depending on their interests or your business goals." - Nick

    See Article