The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Adding a subscriber to one list from my custom built form.

Occasional Contributor

Adding a subscriber to one list from my custom built form.

I have been doing quite a spot of work with config.php and index.php as they are provided in the GIT download. I am realizing that the flow of the program requires my username and password to be entered before I am launched back to the return URI. I have tried setting the username and access token as directed in config.php however adding those variables causes the program to break down.


What I am after here is to take my custom form and when the user submits the form they are added to the subscriber list without the need for any other steps whatsover. I am looking for the PHP integration that runs silently in the background.


I am inquiring could I get some more information on how that is supposed to be done?


As well I am wondering how exactly to capture the access token as I see a lot of talk of this token but I am not seeing clearly how the token would be gotten through code nor any discussion in depth about how the access token might be reused over again if that is possible at all.


I can't have my users going through an authentication process as that will break the whole flow of my website.


Thank you in advance for any helpful information as regards to this process.....




Re: Adding a subscriber to one list from my custom built form.



Your subscribers certanly won't have to generate their own access token.  From their side, they should simply enter their email address (and any other fields you specify like first name), press submit, and be done.



If you replace the contents of config.php with this, filling in your username, password/access token, and API Key, you won't be prompted to grant access or login again.




$username = "";

$password = ""; //needed for basic auth which is being deprecated

$accessToken = ""; //needed for Oauth2

$apikey = "";




You have a couple of options: use OAuth2, or use basic authentication.  Basic authentication is quicker to implement, since you only need to provide your password, but we will be deprecating it in the next year or so.  We do also plan to have an easier process in the future for getting an OAuth2 access token, so you can either use basic for now and update the config file with your access token later, or go through the OAuth2 process now.  Instructions for how to install an OAuth2 flow and get your access token are here.  After you go through that, you simply copy and paste your access token into the config file.


Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More