We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Adding Contacts to List with OAuth?

MaggieS418
Home & Building Services

Adding Contacts to List with OAuth?

Maybe I'm missing something, but I don't understand how the OAuth flow works when adding contacts to a list from a "Email Signup" form on a website, where the user obviously doesn't have access to the Constant Contact account. The API method I'm looking at is here: https://v3.developer.constantcontact.com/api_guide/contacts_create_or_update.html

 

OAuth authentication just doesn't make sense in this scenario. 

6 REPLIES 6
JeremyP50
Participant

I am looking for this exact issue as well and I can't see how it is possible.

JeffE86
Retail

I spent a lot of time on this, and it doesn't appear that non-interactive Oauth is possible with the v3 api.  It renders their api useless for server-to-server applications. 

NCPC_DC
Occasional Participant

I basically asked the same question about a week ago See Here and I have received no replies. I am beginning to doubt the helpfulness of this forum.

Courtney_E
Moderator

Hello MaggieS418,

 

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

 

When adding contacts to a list from a custom sign-up form app, the "user" referred to in the OAuth Server Flow would be the owner of the website who is setting up the form, as opposed to the contacts filling out the form. The owner of the website (and Constant Contact account) would grant the app access to their account during the initial setup of the form, after which the app would use step 5 of the Server Flow to exchange it's Refresh Token for a new pair of tokens whenever the Access Token expires, without the owner needing to log in again.

 

V3 API OAuth2.0 Server Flow

https://developer.constantcontact.com/api_guide/server_flow.html

 

V3 API Token Overview

https://developer.constantcontact.com/api_guide/auth_overview.html#tokens


Regards,

Courtney E.
API Support Specialist

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.
igvinc
Member

Same problem here.

In V2 of the API

We have a simple HTML/PHP signup form on a basic landing page

  • We have an API key, a Secret, and a Token
  • Users fills out the form, agrees to terms, gets a Double opt in
  • Result: using the LIST_ID, and 2 custom fields the user is added to a specific list.
  • done. (works great only in V2)

 

that brings us to v3...  :(. . .

I think you are right, so far it has proven Impossible to accomplish the simple task of
"adding 1 user to a specific list with some custom fields"

  • No way to generate an access token that stays good long enough to leave the landing page up
  • No way to add 1 user to a specific list
  • Documentation does not make sense
  • Constantly have to refresh the token
  • No clear examples
  • Examples given do not work

Other problems we ran into:

  • https://v3.developer.constantcontact.com/api_guide/contacts_create.html
    Create contacts has no explanation on how to add that 1 user to a specific list
  • 'authorization' => 'Bearer {access_token}'
    Disambiguation needed
    Assume access_token = 12345
  • Does not work: '{12345}'
  • Does not work: 'Bearer {12345}'
  • Does not work: 'Bearer 12345'
  • Does not work: '12345'
  • access_token and refresh_token constantly expire
  • Impossible to hardcode API_key, Secret, Token into a variable in PHP to allow landing pages to work

Our Conclusion:

V3 does not work for adding 1 contact to a list after they fill out a form.

 

Ergo: Our solution was and still is to use v2
(or switch to another platform that has a working API, which seems rude/inappropriate to talk about any further in this forum)

 

Sorry... but you are not alone!

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.

 

While V2 API Access tokens are valid for 10 years, V3 Access tokens automatically expire two hours after their last use, with a maximum lifetime of twenty four hours. This ensures a higher level of security for the connection. The V3 refresh token does not expire unless it is used or a new refresh token has been generated. Refresh tokens can only be used once, as generating a new set of tokens causes all previous tokens to expire.

 

You will need 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 5 of the OAuth2.0 Server 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-5-refresh-the-access-token

 

How to Make Access Tokens Last Longer
https://developer.constantcontact.com/api_guide/faqs_manage_applications.html

 

You can use the POST /contacts/sign_up_form endpoint to add a new contact to an account or update an existing contact based on their email address.

 

Create or Update a Contact
https://v3.developer.constantcontact.com/api_guide/contacts_create_or_update.html

 

The request for V3 application code samples is currently under review. However, we're currently still adding endpoints and capabilities to the V3 API, and do not plan to publish official SDKs or sample apps until that process is complete. Your feedback and experience with this request is essential to improving our product, so thank you for reaching out to us regarding this matter.

In the meantime, here are the example calls that are currently available for V3:

 

V3 Code Samples:
https://v3.developer.constantcontact.com/api_guide/tag_code_samples.html


Regards,

Courtney E.
API Support Specialist

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.
Developer Portal

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

Visit Page