Re: Customization of Forms

ArielR578
Rookie
0 Votes

I have a related question: We are building a custom front end (using a headless CMS), and the look is very stylized. Like you mention, the formatting is extremely limited, so we know we'll have to do our own HTML. How do I get the link that anchors our SUBSCRIBE button? 

1 REPLY 1
Courtney_E
Moderator
0 Votes

Hello ArielR578,

 

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.

 

If you are looking to build/develop your own website form, or have already developed a form yourself, you can program it to connect with our API and sync contacts over automatically by using our Sign-Up Form Endpoint, which allows you to add contacts to an account without having to make a separate API call to check if the email address already exists for a contact in the user account.

 

Constant Contact provides developers with free access to our V3 API endpoints for developers building their own application for integration. You can get started using our API by visiting our documentation here:

https://v3.developer.constantcontact.com/api_guide/getting_started.html

 

Additionally, you can utilize our API Reference Page to find body schemas & values, as well as test the functionality of our available endpoints to see how they will work once programmed within your application:

https://v3.developer.constantcontact.com/api_reference/index.html

 

For developing an integration to connect a custom HTML form via the API, you’ll want to use the V3 API’s “OAuth2 Authorization Code Flow” to create an authenticated connection that can be maintained using access tokens and refresh tokens after the initial connection.

 

After granting the app permission with your Constant Contact account, you’ll be able to generate your first token set. The access token is what allows your application to make authenticated calls via the API to push the data through, and the refresh token allows you to get a new access token (and refresh token) when the previous access token expires (every 24 hrs).

 

OAuth2 Authorization Code Flow

https://v3.developer.constantcontact.com/api_guide/server_flow.html#step-1-create-an-authorization-r...

 

Once Authentication is set up, you can decide how you want to add contacts to the account. Typically, we see forms that check to see if the contact exists in the account, and then either create a new contact or update the contact using those resective call types. However, we also offer an endpoint specifically for sign-up forms where you can make just one call to complete the action:

 

[Option 1:]

Use the sign-up form endpoint, to add a new contact to an account or update an existing contact based on their email address. Only use this method when a contact gives you their explicit permission to send them emails.

 

Create or Update a Contact Using a Single Method (less recommended)

https://v3.developer.constantcontact.com/api_guide/contacts_create_or_update.html

 

[Option 2:]

Use this flow to add/update your contacts either via a sign-up form or other integration type which incorporates three contact endpoints:

 

Step 1: Check to see if the contact exists in the account using the email query parameter to search for a contact using a specific email address.

 

GET Contacts Collection

https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts

 

Step 2: If the contact comes back as non-existent, use POST to create the contact:

 

POST (create) a Contact

https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/createContact

 

Step 3: If the contact comes back as already existing in the account. You need to append the returned data with the desired list memberships and send that back with PUT to update the contact: (*When Updating a contact, you need to append the new information to the old information and send all of it back in the request, because when you update a contact using a PUT, all properties are updated, overwriting all existing property values. Any properties left blank or not included in the PUT will be overwritten with a null value.)

 

PUT (update) a Contact

https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/putContact

 

If desired, you could then program your form to display a “Thank you” or “Submission Received” page/banner if the call to the API has a successful response:

 

Success Response Codes

https://v3.developer.constantcontact.com/api_guide/glossary_responses.html#success-response-codes

 

While our expertise is with our API itself as opposed to its implementation within any particular programming language, we are happy to answer any questions pertaining to Constant Contact’s API endpoints, functionality, and documentation.

 

Please have a look and let us know if you have any other questions! 

 

You can also reach our team directly/securely via email at webservices@constantcontact.com


Regards,

Courtney E.
Tier II API Support Engineer

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

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up

Polls
How confident are you about the effectiveness of your current marketing strategy?

Top Choice: Not confident at all (66%)