Constant Contact is a popular email marketing software.
In this tutorial, I’ll show you how to connect the Constant Contact REST API to Google Sheets in 7 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser:
After you’ve logged in to your Constant Contact account, on the My Applications section of the developer portal, click the Register link:
The New Application overlay dialog will then be displayed.
Enter a name for your application then click the Save button:
You’ll then be redirected to the App details page. Copy and paste your API Key to a safe location, because you’ll need it again later. Then click the Generate Secret button to display the client secret:
A disclaimer box will be shown, letting you know you’ll have to update your code to use the new secret, if a client secret was previously created for your app. Click Cancel if you do not want to generate a new secret, or click Generate Secret:
The App Secret overlay dialog will be displayed. Copy and paste the secret value to safe location, because you’ll need it in the next steps:
In your browser address bar, copy and paste the following link:
! Don’t forget to replace the following values/parameters:
After you replace the two values and press Enter, an authorization window will be displayed. Click Allow to grant access:
The authorization code will then be displayed in your browser’s address bar. Copy and paste the value of your authorization code to a safe location and proceed with the following step, as this code is only valid for 60 seconds!
To generate an access token, open up a command prompt window (for Windows OS) or a terminal (for Mac OS) and compose the following curl command:
curl -X POST -i -H "application/x-www-form-urlencoded" -H "authorization: Basic Base64_encoded_value" "https://idfed.constantcontact.com/as/token.oauth2?code=your_authorization_code&redirect_uri=your_redirect_URI&grant_type=authorization_code"
You’ll need to replace a few values:
Note: For Mac OS you may need to use single quotes ( ' ) instead of double quotes ( " ).
Your access token will be displayed in the response. Copy and paste the value to a safe location, because you’ll need it in the next steps.
Note: If the token/key that you generate has an expiration time, you will need to complete this same process again to get a new token when the old one expires.
In this section, we’ll show you how to browse the Constant ContactAPI documentation to find the API endpoint URL that retrieves the information you need from your Constant Contact account. Every API has a URL, and every URL has an endpoint which is the last part of the URL that tells the API what data to return back to you.
If you already know your URL and endpoint, or you want to use the same example as us, just skip to Step 6.
To look through available endpoints, first open the Constant Contact API documentation page: https://v3.developer.constantcontact.com/api_reference/index.html#!/Account_Services/retrieveEmailAddresses
The menu on the left contains the Base URL for this API and the API Reference section. In the API Reference section, you can find a list of categories, each with its own endpoints.
Clicking on a category such as Account Services will scroll to that category’s section and show you a list of the associated endpoints:
For example, when clicking the Contacts category, the page scrolls to an introduction section and a list of 7 endpoints:
If you want to check whether certain data is available via the Constant Contact API, the API documentation is where you go to find all the available endpoints that you can query.
Another example endpoint is GET Contacts Collection, and this is what the whole API URL looks like put together, include the base URL (https://api.cc.email/v3) and endpoint (/contacts):
Each endpoint’s documentation contains descriptions of the endpoint’s purpose, the available parameters, response messages, and an option to make a test request to the endpoint. On a separate column on the right, you can find the CURL response to the endpoint:
All API calls to Constant Contact should be made to this base URL:
All endpoints are appended to that base URL.
Note: Check their documentation to confirm the latest version and update the version number in the URL if necessary.
Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab. With the Import tab open, enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 5, we explained how you can find the Constant Contact REST API endpoint that you need. Now copy and paste your complete Constant Contact API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).
For this example, we are using the /account/emails endpoint that returns a collection of email addresses for the account associated with your access token. This is what the whole URL looks like:
If you’re following the same example as us, you can copy and paste this URL into Apipheny, where it says “API URL”.
Headers: In the Headers section of Apipheny, add two rows with the following keys and values:
Header 1 Key: Authorization Value: Bearer your_token Header 2 Key: Content-Type Value: Application/json
Where it says your_ token, copy and paste your actual token that you got in Step 4. There should be a space between the word Bearer and your_ token.
Here’s what your API request should look like when entered into Apipheny, if you’re following the same example as us or using a similar endpoint:
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Constant Contact API data to be imported into your Google Sheet. Here’s what our request looked like when completed:
That’s it! You’ve successfully connected your Constant Contact account to Google Sheets using the Constant Contact API, Google Sheets API, and the Apipheny add-on.
After making a successful request to the Constant Contact API, try querying a different Constant Contact API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Schedule requests for automatic updates
Reference cell values in requests
Stack multiple URLs in a single request
Run all saved requests at once
Crypto API tutorials and more:
Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool
Accept donations on Twitch | Accept donations on Discord | Accept donations on YouTube | Accept donations on Telegram | Accept donations on Twitter | Accept donations on TikTok | Accept donations on Instagram | Accept donations on LinkedIn | Accept donations on Facebook | Accept donations on your Website