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 a subscriber to one list from my custom built form.


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






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