API Connector Documentation
Import Constant Contact Data to Google Sheets
In this guide, we’ll walk through how to pull data from the Constant Contact API directly into Google Sheets, using the API Connector add-on for Google Sheets.
Constant Contact's newest v3 API only supports OAuth, so we'll set up this connection with a custom OAuth connector.
Contents
- Before You Begin
- Part 1: Get Your Constant Contact OAuth Credentials
- Part 2: Connect the Constant Contact API to API Connector
- Part 3: Pull Constant Contact API Data into Sheets
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your Constant Contact OAuth Credentials
- Navigate to https://v3.developer.constantcontact.com/ and click My Applications.
- Click Log in and log in with your regular Constant Contact user name and password.
- Click New Application.
- You'll be prompted to give your application a name (can be anything), select OAuth flow (select "Authorization Code Flow and Implicit Flow"), choose a refresh token type (can be either), and click Create.
- You should now see your new app. Click Edit
- We'll do 2 things on the Edit page: Click Generate Client Secret, and enter API Connector's redirect URL (provided here).
- The Client Secret will only be shown once, so copy it down and keep it safe. We'll also need the Client Id (they call it the API key). Keep both handy as we'll need them shortly.
- Click Save before you go! Your app configuration won't be saved automatically.
Part 2: Connect the Constant Contact API to API Connector
- Open up Google Sheets and click Extensions > API Connector > Manage Connections
- Scroll to the bottom of the sidebar and click Add Custom OAuth
- Fill in the Custom OAuth modal as follows:
- OAuth Grant Type:
Authorization Code
- Name:
Custom CC
- Authorization Base URL:
https://authz.constantcontact.com/oauth2/default/v1/authorize?scope=account_read account_update contact_data offline_access campaign_data
- Token URL:
https://authz.constantcontact.com/oauth2/default/v1/token
- Client ID: provided by Constant Contact
- Client Secret: provided by Constant Contact
- OAuth Grant Type:
- Click Save
- Click Manage Connections to return to the list of connections
- Scroll down until you find your new custom connection. Click Connect
- You'll be prompted to give access to the new app you created above. Click Allow Access
- You'll be returned to your sheet and can verify that the new connection is now active.
Part 3: Pull Constant Contact API Data into Sheets
You can fetch any of the data points shown in the API documentation. For this example, we'll pull in the contents of a contact list. For this we'll need your list ID, which you can get by checking the URL while logged into Constant Contact (or through an API request to the contact_list endpoint).
Once you have your list ID, configure your API request like this:
- Open up Google Sheets and click Extensions > API Connector > Open > Create request.
- In the request form enter the following:
- Application:
Custom
- Method:
GET
- Request URL:
https://api.cc.email/v3/contacts?lists=your_list_id
- OAuth:
Custom CC
- Application:
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see Constant Contact data populate your sheet.
Part 4: API Documentation
v2 Official API documentation: https://v2.developer.constantcontact.com/docs/developer-guides/api-documentation-index.html
v3 Official API documentation: https://developer.constantcontact.com/api_guide/v3_technical_overview.html
I'm a total novice when it comes to accessing APIs. I have successfully connected ConstantContact API to a Google Sheet per the above instructions and can pull direct data successfully. However, how can I loop through API calls that require a parameter (ie contactid or campaignid)?
Hey Kourtney, you can loop through multiple parameters as described here: https://mixedanalytics.com/knowledge-base/api-connector-run-multiple-queries-single-request/. You can either list out all your URLs in the API URL box, or you can list your contactid or campaignid parameters in a sheet and reference them as described in the "Reference a Range of Cells" section. Let me know if you have any questions!