Installation & Configuration

You will need to create a developer account with Constant Contact, which you can do by going to https://developer.constantcontact.com/{target="_blank"}

After you have registered, you will need to create an app, which can be done at
https://app.constantcontact.com/pages/dma/portal/{target="_blank"}

Here are the settings you should use when creating the app:

  1. OAuth2 Type: Authorization Code Flow and Implicit Flow
  2. Rotating Refresh Tokens

Redirect URI - you can see this in the Constant Contact section of your ConcreteCMS dashboard - it is your site's home page URI with
/constantc appended, e.g.*https://www.example.com/constantc (*if you don't have URL rewriting turned on it will be *index.php/constantc)
*

You must use this URL or you will not be able to authroise the app.

You may use the app's Client ID and Client Secret on more than one domain. If you do, you will need to add each Redirect URI to your app.

You will need to click the Generate Client Secret button, to get a new secret. <span style="text-decoration: underline;">Make sure to copy this immediately because it won't be shown again and can only be regenerated, which will break any other sites that are using the same credentials.</span>

Once you have a Client ID and Secret, go to the Constant Contact page in the ConcreteCMS dashboard.

You will see a token error. This is normal. Paste in the Client ID and Secret, and Save.

You'll see the token error again. You now have to click the Authorise Constant Contact button. This will redirect you to Constant Contact where you will log in with your usual account details, not your developer ones (although they may be the same thing if you have just one site).

You will see an authorisation screen and you should choose to grant access to the app.

User Permission Request
Screen{.docimage width="600"}

Upon doing so, you'll be directed back to your ConcreteCMS dashboard and you should see a success message. You will also see a dropdown list of all your mailing lists, where you can select a default list for use in other integrations.

You should then be able to visit the page where you require the signup form, add the Constant Contact block and that's it.

For developers, you can use the ConstantContact class to silently subscribe users to the default mailing list by doing something like this:

<?php
**use Jero\ConstantContact\ConstantContact as CC;
**
$cc = new CC;
$args = [
'first_name'=>'John',
'last_name' => 'Smith',
'email_address' => 'john@example.com',
'list_memberships' => [
'guid',
'guid2']
];

$cc->subscribe($args);

where guid etc are the IDs of one or more of your mailing lists that you will find by examining $cc->getLists();