Overview

Namespaces

  • Ctct
    • Auth
    • Components
      • Account
      • Activities
      • Contacts
      • EmailMarketing
      • Tracking
    • Exceptions
    • Services
  • PHP

Classes

  • ConstantContact
  • SplClassLoader
  • Overview
  • Namespace
  • Class
  • Tree

Class ConstantContact

Exposes all implemented Constant Contact API functionality

Namespace: Ctct
Package: Ctct
Author: Constant Contact
Version: 1.1.0
Located at Ctct/ConstantContact.php
Methods summary
public
# __construct( string $apiKey )

Class constructor Registers the API key with the ConstantContact class that will be used for all API calls.

Class constructor Registers the API key with the ConstantContact class that will be used for all API calls.

Parameters

$apiKey
string
$apiKey - Constant Contact API Key
public Ctct\Components\ResultSet
# getContacts( string $accessToken, array $params = array() )

Get a set of campaigns

Get a set of campaigns

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. modified_since - ISO-8601 formatted timestamp. next - the next link returned from a previous paginated call. May only be used by itself. email - the contact by email address to retrieve information for

Returns

Ctct\Components\ResultSet
containing a results array of Ctct\Components\Contacts\Contact
public Ctct\Components\Contacts\Contact
# getContact( string $accessToken, integer $contactId )

Get an individual contact

Get an individual contact

Parameters

$accessToken
string
$accessToken - Valid access token
$contactId
integer
$contactId - Id of the contact to retrieve

Returns

Ctct\Components\Contacts\Contact
public array
# getContactByEmail( string $accessToken, string $email )

Get contacts with a specified email eaddress

Get contacts with a specified email eaddress

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$email
string
$email - contact email address to search for

Returns

array
public Ctct\Components\Contacts\Contact
# addContact( string $accessToken, Ctct\Components\Contacts\Contact $contact, boolean $actionByVisitor = false )

Add a new contact to an account

Add a new contact to an account

Parameters

$accessToken
string
$accessToken - Valid access token
$contact
Ctct\Components\Contacts\Contact
$contact - Contact to add
$actionByVisitor
boolean
$actionByVisitor - is the action being taken by the visitor

Returns

Ctct\Components\Contacts\Contact
public boolean
# deleteContact( string $accessToken, mixed $contact )

Sets an individual contact to 'REMOVED' status

Sets an individual contact to 'REMOVED' status

Parameters

$accessToken
string
$accessToken - Valid access token
$contact
mixed
$contact - Either a Contact id or the Contact itself

Returns

boolean

Throws

Ctct\Exceptions\IllegalArgumentException
- if an int or Contact object is not provided
public boolean
# deleteContactFromLists( string $accessToken, mixed $contact )

Delete a contact from all contact lists

Delete a contact from all contact lists

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or the Contact object itself

Returns

boolean

Throws

Ctct\Exceptions\IllegalArgumentException
- if an int or Contact object is not provided
public boolean
# deleteContactFromList( string $accessToken, mixed $contact, mixed $list )

Delete a contact from all contact lists

Delete a contact from all contact lists

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or a Contact object
$list
mixed
$list - ContactList id or a ContactList object

Returns

boolean

Throws

Ctct\Exceptions\IllegalArgumentException
- if an int or Contact object is not provided, as well as an int or ContactList object
public Ctct\Components\Contacts\Contact
# updateContact( string $accessToken, Ctct\Components\Contacts\Contact $contact, boolean $actionByVisitor = false )

Update an individual contact

Update an individual contact

Parameters

$accessToken
string
$accessToken - Valid access token
$contact
Ctct\Components\Contacts\Contact
$contact - Contact to update
$actionByVisitor
boolean
$actionByVisitor - is the action being taken by the visitor, default is false

Returns

Ctct\Components\Contacts\Contact
public array
# getLists( string $accessToken, array $params = array() )

Get lists

Get lists

Parameters

$accessToken
string
$accessToken - Valid access token
$params
string
$date - ISO-8601 date to query by

Returns

array
public Ctct\Components\Contacts\ContactList
# getList( string $accessToken, integer $listId )

Get an individual list

Get an individual list

Parameters

$accessToken
string
$accessToken - Valid access token
$listId
integer
$listId - Id of the list to retrieve

Returns

Ctct\Components\Contacts\ContactList
public Ctct\Components\Contacts\ContactList
# addList( string $accessToken, Ctct\Components\Contacts\ContactList $list )

Add a new contact list to an account

Add a new contact list to an account

Parameters

$accessToken
string
$accessToken - Valid access token
$list
Ctct\Components\Contacts\ContactList
$list - List to add

Returns

Ctct\Components\Contacts\ContactList
public Ctct\Components\Contacts\ContactList
# updateList( string $accessToken, Ctct\Components\Contacts\ContactList $list )

Update a contact list

Update a contact list

Parameters

$accessToken
string
$accessToken - Valid access token
$list
Ctct\Components\Contacts\ContactList
$list - ContactList to update

Returns

Ctct\Components\Contacts\ContactList
public array
# getContactsFromList( string $accessToken, mixed $list, mixed $param = null )

Get contact that belong to a specific list

Get contact that belong to a specific list

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$list
mixed
$list - Id of the list or a ContactList object
$param
mixed
$param - denotes the number of results per set, limited to 50, or a next parameter provided from a previous getContactsFromList call

Returns

array

Throws

Ctct\Exceptions\IllegalArgumentException
- if a ContactList object or id is not passed
public Ctct\Components\ResultSet
# getEmailCampaigns( string $accessToken, array $params = array() )

Get a set of campaigns

Get a set of campaigns

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. modified_since - ISO-8601 formatted timestamp. next - the next link returned from a previous paginated call. May only be used by itself. email - the contact by email address to retrieve information for

Returns

Ctct\Components\ResultSet
containing a results array of Ctct\Components\EmailMarketing\Campaign
public
# getEmailCampaign( string $accessToken, integer $campaignId )

Get an individual campaign

Get an individual campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaignId
integer
$campaignId - Valid campaign id
public boolean
# deleteEmailCampaign( string $accessToken, mixed $campaign )

Delete an individual campaign

Delete an individual campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Id of a campaign or a Campaign object itself

Returns

boolean

Throws

Ctct\Exceptions\IllegalArgumentException
- if a Campaign object or campaign id is not passed
public Ctct\Components\EmailMarketing\Campaign
# addEmailCampaign( string $accessToken, Ctct\Components\EmailMarketing\Campaign $campaign )

Create a new campaign

Create a new campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
Ctct\Components\EmailMarketing\Campaign
$campaign - Campaign to be created

Returns

Ctct\Components\EmailMarketing\Campaign
- created campaign
public Ctct\Components\EmailMarketing\Campaign
# updateEmailCampaign( string $accessToken, Ctct\Components\EmailMarketing\Campaign $campaign )

Update a specific campaign

Update a specific campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
Ctct\Components\EmailMarketing\Campaign
$campaign - Campaign to be updated

Returns

Ctct\Components\EmailMarketing\Campaign
- updated campaign
public Ctct\Components\EmailMarketing\Schedule
# addEmailCampaignSchedule( string $accessToken, mixed $campaign, Ctct\Components\EmailMarketing\Schedule $schedule )

Schedule a campaign to be sent

Schedule a campaign to be sent

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign to be updated
$schedule
Ctct\Components\EmailMarketing\Schedule
$schedule - Schedule to be associated with the provided campaign

Returns

Ctct\Components\EmailMarketing\Schedule
schedule created
public array
# getEmailCampaignSchedules( string $accessToken, mixed $campaign )

Get an array of schedules associated with a given campaign

Get an array of schedules associated with a given campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself

Returns

array
public array
# getEmailCampaignSchedule( string $accessToken, mixed $campaign, mixed $schedule )

Get a specific schedule associated with a given campaign

Get a specific schedule associated with a given campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$schedule
mixed
$schedule - Schedule id or Schedule object itself

Returns

array

Throws

Ctct\Exceptions\IllegalArgumentException
public array
# updateEmailCampaignSchedule( string $accessToken, mixed $campaign, Ctct\Components\EmailMarketing\Schedule $schedule )

Update a specific schedule associated with a given campaign

Update a specific schedule associated with a given campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$schedule
Ctct\Components\EmailMarketing\Schedule
$schedule - Schedule to be updated

Returns

array
public array
# deleteEmailCampaignSchedule( string $accessToken, mixed $campaign, mixed $schedule )

Delete a specific schedule associated with a given campaign

Delete a specific schedule associated with a given campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$schedule
mixed
$schedule - Schedule id or Schedule object itself

Returns

array

Throws

Ctct\Exceptions\IllegalArgumentException
public Ctct\Components\EmailMarketing\TestSend
# sendEmailCampaignTest( string $accessToken, mixed $campaign, Ctct\Components\EmailMarketing\TestSend $test_send )

Send a test send of a campaign

Send a test send of a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$test_send
Ctct\Components\EmailMarketing\TestSend
$test_send - test send details

Returns

Ctct\Components\EmailMarketing\TestSend
public Ctct\Components\ResultSet
# getEmailCampaignSends( string $accessToken, mixed $campaign, array $params = array() )

Get sends for a campaign

Get sends for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\SendActivity
public Ctct\Components\ResultSet
# getEmailCampaignBounces( string $accessToken, mixed $campaign, array $params = array() )

Get bounces for a campaign

Get bounces for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\BounceActivity
public Ctct\Components\ResultSet
# getEmailCampaignClicks( string $accessToken, mixed $campaign, array $params = array() )

Get clicks for a campaign

Get clicks for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\ClickActivity
public Ctct\Components\ResultSet
# getEmailCampaignOpens( string $accessToken, mixed $campaign, array $params = array() )

Get opens for a campaign

Get opens for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\OpenActivity
public Ctct\Components\ResultSet
# getEmailCampaignForwards( string $accessToken, mixed $campaign, array $params = array() )

Get forwards for a campaign

Get forwards for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\ForwardActivity
public Ctct\Components\ResultSet
# getEmailCampaignUnsubscribes( string $accessToken, mixed $campaign, array $params = array() )

Get unsubscribes for a campaign

Get unsubscribes for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\UnsubscribeActivity
public Ctct\Components\Tracking\TrackingSummary
# getEmailCampaignSummaryReport( string $accessToken, mixed $campaign )

Get a reporting summary for a campaign

Get a reporting summary for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$campaign - Campaign id or Campaign object itself

Returns

Ctct\Components\Tracking\TrackingSummary
public Ctct\Components\ResultSet
# getContactSends( string $accessToken, mixed $contact, array $params = array() )

Get sends for a Contact

Get sends for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\Tracking\SendActivity
public Ctct\Components\ResultSet
# getContactBounces( string $accessToken, mixed $contact, array $params = array() )

Get bounces for a Contact

Get bounces for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\Tracking\BounceActivity
public Ctct\Components\ResultSet
# getContactClicks( string $accessToken, mixed $contact, array $params = array() )

Get clicks for a Contact

Get clicks for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\Tracking\ClickActivity
public Ctct\Components\ResultSet
# getContactOpens( string $accessToken, mixed $contact, array $params = array() )

Get opens for a Contact

Get opens for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\Tracking\OpenActivity
public Ctct\Components\ResultSet
# getContactForwards( string $accessToken, mixed $contact, array $params = array() )

Get forwards for a Contact

Get forwards for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\Tracking\ForwardActivity
public Ctct\Components\ResultSet
# getContactUnsubscribes( string $accessToken, mixed $contact, array $params = array() )

Get opt outs for a Contact

Get opt outs for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself
$params
mixed
$params - associative array of query parameters and values to append to the request. Allow parameters include: limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50. created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format). next - the next link returned from a previous paginated call. May only be used by itself.

Returns

Ctct\Components\ResultSet
- Containing a results array of Ctct\Components\Tracking\UnsubscribeActivity
public array
# getVerifiedEmailAddresses( string $accessToken, string $status = null )

Get verified addresses for the account

Get verified addresses for the account

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$status
string
$status - Status to filter query results by

Returns

array
of VerifiedEmailAddress objects
public Ctct\Components\Tracking\TrackingSummary
# getContactSummaryReport( string $accessToken, mixed $contact )

Get a reporting summary for a Contact

Get a reporting summary for a Contact

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$contact
mixed
$contact - Contact id or Contact object itself

Returns

Ctct\Components\Tracking\TrackingSummary
public array
# getActivities( string $accessToken )

Get an array of activities

Get an array of activities

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token

Returns

array
of Ctct\Components\Activities\Activity
public {@link
# getActivity( string $accessToken, string $activityId )

Get a single activity by id

Get a single activity by id

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$activityId
string
$activityId - Activity id

Returns

{@link
Ctct\Components\Activities\Activity}
public
# addCreateContactsActivity( string $accessToken, Ctct\Components\Activities\AddContacts $addContactsActivity )

Add an AddContacts Activity to add contacts in bulk

Add an AddContacts Activity to add contacts in bulk

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$addContactsActivity
Ctct\Components\Activities\AddContacts
- Add Contacts Activity
public
# addClearListsActivity( string $accessToken, array $lists )

Add an ClearLists Activity to remove all contacts from the provided lists

Add an ClearLists Activity to remove all contacts from the provided lists

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$lists
Ctct\Components\Activities\AddContacts
- Add Contacts Activity
public
# addRemoveContactsFromListsActivity( string $accessToken, array $emailAddresses, array $lists )

Add a Remove Contacts From Lists Activity

Add a Remove Contacts From Lists Activity

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$emailAddresses
array
$emailAddresses - email addresses to be removed
$lists
array
$lists - lists to remove the provided email addresses from
public array
# addExportContactsActivity( string $accessToken, Ctct\Components\Activities\ExportContacts $exportContacts )

Create an Export Contacts Activity

Create an Export Contacts Activity

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$exportContacts
Ctct\Components\Activities\ExportContacts
$exportContacts

Returns

array
- Array of all ActivitySummaryReports
Properties summary
protected Ctct\Services\ContactService $contactService
#

ContactService for handling interaction with contact management

ContactService for handling interaction with contact management

protected CampaignService $emailMarketingService
#

EmailMarketingService for handling interaction with email marketing

EmailMarketingService for handling interaction with email marketing

protected Ctct\Services\ListService $listService
#

ListService for handling interaction with contact list management

ListService for handling interaction with contact list management

protected Ctct\Services\ActivityService $activityService
#

ActivityService for handling interaction with bulk activities

ActivityService for handling interaction with bulk activities

protected Ctct\Services\CampaignTrackingService $campaignTrackingService
#

CampaignTrackingService for handling interaction with email marketing tracking

CampaignTrackingService for handling interaction with email marketing tracking

protected Ctct\Services\ContactTrackingService $contactTrackingService
#

ContactTrackingService for handling interaction with contact tracking

ContactTrackingService for handling interaction with contact tracking

protected Ctct\Services\CampaignScheduleService $campaignScheduleService
#

CampaignScheduleService for handling interaction with email marketing campaign scheduling

CampaignScheduleService for handling interaction with email marketing campaign scheduling

protected Ctct\Services\AccountService $accountService
#

AccountService for handling interaction with account management

AccountService for handling interaction with account management

Appconnect PHP SDK API documentation generated by ApiGen 2.8.0