Got a 'How do I' question? Join 'Ask a Trainer' Monday to Friday, 11am to 4pm ET for instant help and pro tips!

API - Get contacts using updated_after doesn't return all contacts that are unsubscribed

user6365
Campaign Contributor
0 Votes

Hi,

 

I'm using this endpoint to get contacts after a specific date/time https://v3.developer.constantcontact.com/api_guide/contacts_sync.html#sync-contacts
I'm assuming this endpoint will return any contacts that have changed base on the date/time passed in the parameter "updated_after" including if a contact was unsubscribed from CC. However, looking at the response (json format) the value of updated_at are not always the same as the value of "email_address.updated_at" .

 

For example, an existing contact "abc" was unsubscribed on "2024-06-08", and use this endpoint ({{base_url}}/contacts/:contact_id?) to check the detail. I can see this contact has "updated_at" on "2023-01-30T18:04:55Z" but the "email_address.updated_at" was "2024-06-08T01:31:05Z". So if you run the GET contact sync endpoint (GET /contacts?updated_after={date&time_last_sync}) with the parameter updated_after=2024-06-01T01:31:05Z (like 7 days ago from 2024-06-08T01:31:05Z), you will not receive the updated record for the contact "abc" because the updated_after only applies to the "updated_at". This only gets fixed if the "updated_at" and "email_address.updated_at" are the same.

 

Is there an alternative approach to get unsubscribed contacts using updated_after param?

Thank you.

1 REPLY 1
Courtney_E
Moderator
0 Votes

Hello user6365,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

Our API is not able to directly retrieve opt outs from after a certain date.The "updated_at" value displayed for contacts in the section beginning with "create_source" refers to the last time the contact details were updated. As you can see in the Response Schema example in the right-hand side of the API Reference Page, this is grouped in with other contact details such as name and address. These are stored in a different area of the database than the "updated_at" for "email_address" details, which includes the "opt_out_date". 

 

 API Reference Page - GET Contacts Collection

https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts 

 

The “updated_after” query parameter that can be used with the Contacts endpoint only applies to the "updated_at" value that identifies who last updated the contact’s personal information, and the "update_source"  will only appear for contacts who’s contact information has been updated since they were added (examples: "first_name", "last_name", "job_title", "company_name", "birthday_month", etc…).

 

The "updated_at" value that displays for email addresses in the section starting with "contact_id" does reflect when an email address unsubscribes or is put into another status, but there’s not a parameter available for narrowing by this value when making calls. You can only query for the "updated_at" value for when contact details were last updated.

 

In order to retrieve opt outs after a certain date, your best option would be to send a GET call to the Contacts endpoint with the status parameter set to OPTOUT and then program your application to parse the results and display only values within the desired range as the API cannot call them directly.

 

  {

     "contact_id":

      "email_address": {

        "address": 

        "permission_to_send":

        "created_at": 

        "updated_at": This identifies the last time the status of the contact was updated (if "permission_to_send" changes), and there is not a direct parameter in the API that can call this value, it is just included in the response when making other calls.

        "opt_out_source": 

        "opt_out_date": 

        "opt_out_reason": 

        "confirm_status": 

      },

      "update_source": This identifies who last updated the contact’s personal information. The "update_source" value will only appear for contacts who’s contact information has been updated since they were added (examples: "first_name", "last_name", "job_title", "company_name", "birthday_month", etc…)

      "create_source": 

      "created_at": 

      "updated_at": The “updated_after” query parameter only applies to this value. The  "updated_at" value here only applies to when a contact’s personal information was last updated (examples: "first_name", "last_name", "job_title", "company_name", "birthday_month", etc…)

    }

 

Please have a look and let us know if you have any other questions!


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up