Keeping data in sync between the integrated application and Constant Contact is one of the most important aspects of building a successful integration with Constant Contact.
Why syncing data is important
As a sender of bulk email marketing you must be concerned with:
- Anti-spam laws require the senders of commercial electronic email to respect the wishes of individuals who have unsubscribed and no longer wish to receive email from an organization.
- Respecting subscriber preferences – if you offer multiple email subscriptions, you should send subscribers only the content they have indicated they want to receive. Subscriber preferences change over time.
There are several API features that make syncing data easy and reliable for developers.
What data can I sync?
There are lots of choices for synchronizing data between your application and Constant Contact. Here are a few examples.
- Contact information
- Personal info
- Interests and preferences
- Tracking data
- List memberships
- Campaigns
- Scheduling data
- Tracking data
- Events
- Registrants
- Guests
- Item inventory
Syncing data 101
Syncing data implies that there are two data stores of the same or nearly the same information, with at least one of them being modified on a regular basis. Here is a simple example:
- The primary data store – this is the source of record, it always has the latest and greatest, with data changes occur here live.
- The secondary data store – this store is always updated with any changes occurring in the primary data store.
GET, COMPARE, UPDATE
- Get the data from both the primary and secondary data stores.
- Compare the data to identify differences between objects in each store.
- Update the compared objects in the secondary store with the object data from the primary store.
Performing data syncs on a regular cadence is an important element to consider and design into your integration.
The following figure shows event sequence required to sync data when the user’s Constant Contact account is the primary data store. Constant Contact data gets modified by various subscriber activities. These activities trigger a change to the contact’s modified_date property, which you can leverage to retrieve only those contacts with changes since the last sync activity. The list of modified or new contacts is compared with the customer relationship management (CRM) application data store, and any changes identified by the compare are then uploaded to the CRM to get it back in sync with the CTCT data.
I only want to sync new or changed data
There are a couple of query parameters to use when retrieving data from Constant Contact that allow to retrieve only objects that are either new or modified since a specific time, such as the last time the system performed a data sync.
- modified_since – used for contacts-related properties
- created_since – used for activity-related properties
Syncing contact data using modified_since
The modified_since
query parameter is a filter used to retrieve only those contacts with a modified_date value that is later than the date and time specified by modified_since.
GET https://api.constantcontact.com/v2/contacts ?modified_since=2014-12-01 &api_key=<api_key>
By setting modified_since to the date and time of your most previous data sync, you will retrieve only the contacts that have been modified (including new contacts) since that last data sync. Changes to the following contact properties originated from either the API or the product UI cause the modified_date to change:
Contact property | API | GUI |
---|---|---|
email_address | X | X |
first_name | X | X |
last_name | X | X |
company_name | X | X |
job_title | X | X |
home_phone | X | X |
work_phone | X | X |
cell_phone | X | X |
fax | X | X |
custom_field | X | X |
lists | X | X |
notes | X | X |
Website | N/A | X |
Social profile | N/A | X |
Email type | N/A | X |
Email permission | N/A | X |
Tags | N/A | X |
Syncing contact preferences
It is extremely important that Constant Contact users are not sending campaigns to contacts who have removed themselves from a particular list, or to those who have opted out of receiving all communications from Constant Contact accounts. A contact who has opted out from all communications has a status = optout. You can retrieve a list of all contacts with status = optout by using the status query parameter when making a GET Contacts Collection call. It’s best to sync opt outs regularly, so use the modified_since query parameter set to the date and time of the last sync activity along with status = optout.
GET https://api.constantcontact.com/v2/contacts ?modified_since=2014-12-01 &status=optout &api_key=<api_key>
Syncing lists
If you maintain lists in both your local application and Constant Contact, it’s very important to make sure all list memberships match. Whichever data store is the source of record, you must keep both stores in sync to avoid sending communications to contacts who no longer wish to receive it. Retrieve all contacts in a list by making a GET Contact List Membership collection. If the source of record is the local data store, you will update each contact that has changed their list subscriptions since the last sync. The easiest way to update specific properties for a contact is by using one of the Import/Update Contacts bulk activity endpoints (multipart or JSON). And, if you are updating more than 10’s of contacts, it’s the most efficient way.
Using the Import/Update Contacts bulk activity endpoints, you only need to include the contact’s email address and the properties that have changed. If you make a PUT Individual Contact call, you will need to include all of the properties for the contact, because properties not included in a PUT are overwritten with null values.
Fetching tracking data
Tracking data provides information about how recipients respond to a campaign, including bounces, clicks, clicks-by-link, forwards, opens, send, opt outs. Use the created_since query parameter to retrieve all tracking data created since the last data sync. Tracking data is available for each campaign and for each contact in a user’s account. You can use this information to generate automation in a CRM application regarding leads, to provide a deeper view of a customer’s interactions with a donor in a donor management application. Tracking data also gives you a quick way to see all campaigns sent to each subscriber, giving you a way to maintain a record in your CRM of all marketing communications sent to each customer, and what actions they took on each campaign.
Use the created_since query parameter set to the date of last data sync to retrieve only tracking data that is new since the most previous data sync.
GET https://api.constantcontact.com/v2/contacts/{contactsId}/tracking/clicks ?created_since=2014-12-01 &api_key=
Leave a Comment