cancel
Showing results for 
Search instead for 
Did you mean: 
Some customers are seeing intermittent errors when attempting to upload a new image or insert an image into their email. While we look into getting this fixed we have found if you try to reattempt your previous action, the image will be visible. We apologize for this inconvenience.

Creating a Contact

Administrator

In order to create a new contact in your Constant Contact account, you need to use the POST method on the contacts collection:

 

https://api.constantcontact.com/ws/customers/{username}/contacts

You also need to pass the request body in XML that represents the contact detail, and set  the request header, Content-type, to application/atom+xml

 

The use of this API to create a contact is designed to handle a small number of contacts (i.e. less than 25).  To add a large number of contacts, use the Activities API resource. (As discussed in the Constant Contact API Terms and Conditions, intentional and unintentional misuse of this discrete API to frequently manage large sets of contacts is subject to API access or account termination).

 

Because we use the Atom specification for XML, there are several elements that are required even though they are not used by the server and are replaced upon a successful contact creation.  These elements are <id>, <title>, <author>, and <updated> elements. The <title> and <author> elements may be empty. The <id> must contain a URI, but since the value is not used by the server, any URI will work. The server does not check for uniqueness when creating a contact because a new unique ID will be created anyway. The <updated> element must contain a date or date/time value, but again the value is not used by the server.

 

The actual contact detail is described in <Contact> element.  The following XML describes the minimal XML body required to create a new contact.

 

<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text"> </title>
<updated>2008-07-23T14:21:06.407Z</updated>
<author></author>
<id>data:,none</id>
<summary type="text">Contact</summary>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
<EmailAddress>test_100@example.com</EmailAddress>
<OptInSource>ACTION_BY_CONTACT</OptInSource>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1" />
</ContactLists>
</Contact>
</content>
</entry>

If you want to add more details when you create a new contact, you can do so by adding additional elements under <Contact> element at the same level as <EmailAddress>.

 

There are two options for <OptInSource> elements: ACTION_BY_CONTACT and ACTION_BY _CUSTOMER.  If the contact is adding himself or herself, use ACTION_BY_CONTACT.  If you are adding the contacts on their behalf, use ACTION_BY_CUSTOMER.  Please note that if you use ACTION_BY_CONTACT, a welcome letter, as specified in your account, will be sent out to them.

 

Contacts who are added with "ACTION_BY_CUSTOMER" do not receive a welcome email. This value MUST be used whenever the contact is being added by anyone other than the contact themselves. Contacts who are added with "ACTION_BY_CUSTOMER" will receive AutoResponder sequences based on the settings of the list they are being added to. Contacts who are added with "ACTION_BY_CUSTOMER" are not included on your "Visitor Signup Report".

Contacts who are added with "ACTION_BY_CONTACT" receive a welcome email. This value *CAN ONLY* be used if the contact is being added as a direct result of an action by the contact themselves (ie they are adding themselves via a public web form). Contacts who are added with "ACTION_BY_CONTACT" will receive AutoResponder sequences. Contacts who are added with "ACTION_BY_CONTACT" are included on your "Visitor Signup Report".

webservices