I've read through the docs, but I am still confused as to how I get an access token in v3 to use on a simple PHP web form (newsletter signup). When I read the info, it sounds like a token is temporary, but I need this to be hard coded on my website. Also, the listed process is confusing.
I just want to add a new contact to a Constant Contact list when a user checks the newsletter signup checkbox on my website quote/contact forms.
I see the API Key. After that it starts to make less sense to me (Redirect URI, OAuth2). Any help would be greatly appreciated.
Hello RTX,
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.
To get started with the V3 API, you’ll want to start by going through the V3 API Authorization Code Flow. Please note, after step 1, you should set up step 4 before proceeding, because the authorization code from steps 2 and 3 only has a lifespan of 300 seconds. The Authorization Code Flow’s documentation also has PHP examples for the Authorization, Access & Refresh token requests .
In step one of the V3 API OAuth2.0 Authorization Code Flow, you’ll want to set up your “redirect_uri” so that after a client grants permission via the Authorization Request URL, Authorization Service can send the user to a webpage that you specify, and also send the Authorization Code back to your application so that it can complete the Authentication process.
V3 API OAuth2.0 Authorization Code Flow
https://v3.developer.constantcontact.com/api_guide/server_flow.html
V3 API OAuth2.0 Overview
https://developer.constantcontact.com/api_guide/auth_overview.html
Once you have your first set of tokens, you’ll want to set the access token and the refresh token as values for corresponding variables in your application, so that when your program runs through step 8 of the OAuth2.0 Authorization Code Flow to get the new set of tokens it can assign new values to those variables to maintain an authenticated connection.
V3 API - Refresh the Access Token
https://v3.developer.constantcontact.com/api_guide/server_flow.html#step-8-refresh-the-access-token
I’m also including documentation on our sign-up form endpoint that you can use to add or update contacts through the form you are developing.
V3 API Sign-up Form Endpoint:
https://developer.constantcontact.com/api_reference/index.html#!/Contacts/createOrUpdateContact
Please have a look and let us know if you have any other questions!
Regards,
Why does a user have to go through the authorization steps when signing up for my newsletter from a form on my website? They don't have to do that when using a constant contact form.
Then it asks them to log in. what if they don't have an account and just want the newsletter?
Hello SunnyB44,
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.
An app developed using our API can be used by any Constant Contact account holder, if the developer chooses to share their app. In our documentation, when the term "user" is used in the OAuth description, this is referring to the Constant Contact account holder who is authorizing the app to access their Constant Contact account.
If you were to develop a sign-up form for your website using Constant Contact’s API, you would be both the developer and the user of the application. Your website visitors who are signing up through your form wouldn’t directly be “users” of the app, they would simply be providing the data (by filling out the form), which the app would then send to Constant Contact.
I hope this helps to clarify the OAuth2 authorization steps.
Please have a look and let us know if you have any other questions!
Regards,
Announcements
Join our list to be notified of new features and updates to our V3 API.
Sign Up