Hello! this may be a tricky question to fully describe, but here goes:
I'm looking to use the API with Python to essentially see which email campaigns were sent to which contacts and when.
We have ~26,000 contacts. I was able to get all the contacts using the cursor (pagination), but the only way I've found to connect contact_id ("https://api.cc.email/v3/contacts/") to campaign_id ("https://api.cc.email/v3/emails/") is via campaign_activity_id (using "https://api.cc.email/v3/reports/contact_reports/").
So, unfortunately, I obviously hit the API limits not even halfway through (since the contact_reports is by individual contact), it also takes an extremely long time to make the actual request and takes over an hour to even get to the API limit (10,000 requests).
Is there something that I am missing and there's a much more straightforward way to map relationships between contact:campaign_activity_id:campaign_id? We're looking to produce visualizations in our BI solution but so far, it seems that there is no direct reference/mapping table that would contain these relationships.
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.
Rather than using the Contacts Reporting endpoint, which searches individually by contact, I'd recommend using the Email Reporting endpoints, which are able to return a list of contacts for the Sends, Opens, etc. for each sent campaign and should cut down substantially on the amount of calls that you need to make.
First, retrieve the "campaign_id" for campaign(s) with current_status": "Done".
GET a Collection of Email Campaigns
Next, use the "campaign_id" to get the "campaign_activity_id"s for the "role"s "primary_email" and "resend" if applicable.
GET Details About a Single Email Campaign
Next, use the "campaign_id" to retrieve the contacts who the email was sent to.
GET an Email Sends Report
The results will display the email address, contact ID, send time, etc for each contact that the campaign was sent to, and can display up to 500 contacts per page, so even with paginated results it should still significantly cut down on the amount of calls you have to make to get the same data.
Please have a look and let us know if you have any other questions!
View API documentation, code samples, get your API key.Visit Page
Join our list to be notified of new features and updates to our V3 API.Sign Up