Custom signup form with API V3

JoscelynW
Occasional Participant

Custom signup form with API V3

Hello,

I'm trying to add contacts via a custom form (not a standard CC form) on a website, but don't want the user to have to take any other actions other than submitting the form. Is this possible?

 

I'm able to add a contact using the server flow, but only after I've logged in and that won't work for anonymous users visiting the website that want to just sign up.

 

I need to use a custom form because I'm doing things on my end with a database that stores data being used in a CC custom field that gets sent along with the contact information when the contact is created.

 

All I've found is outdated methods that don't work.

 

Thank you

2 REPLIES 2
JoscelynW
Occasional Participant

I've got it working, but my only issue is refreshing the token after expiration without granting permission again, either 2 hours after use or 24 hours without being used.

 

If I generate it initially, then keep submitting the form it works fine, but that's not realistic.

 

Can I run a cron job to somehow keep the token alive?

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.

 

Using cron is not the best solution, as the token still has a maximum lifespan of 24 hours, at which point it will expire even if it's been used recently. The best method would be to refresh the access token by using step 5 of the OAuth2.0 Server Flow, which doesn't involve granting permission again:

 

Refresh an access token by sending a POST request to the https://idfed.constantcontact.com/as/token.oauth2 authorization endpoint with the refresh_token and grant_type query parameters. This allows you to obtain a new access token and a new refresh token without having to prompt the user to reauthenticate with Constant Contact.
https://v3.developer.constantcontact.com/api_guide/server_flow.html
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.
Developer Portal

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

Visit Page