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
Located at Ctct/ConstantContact.php
Methods summary
public
# __construct( string $apiKey )

Class constructor

Class constructor

Parameters

$apiKey
string
$apiKey - Constant Contact API Key
public ResultSet
# getContacts( string $accessToken, mixed $param = null )

Get a set of campaigns

Get a set of campaigns

Parameters

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

Returns

ResultSet
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 )

Get lists

Get lists

Parameters

$accessToken
string
$accessToken - Valid access token

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 ResultSet
# getEmailCampaigns( string $accessToken, mixed $param = null )

Get a set of campaigns

Get a set of campaigns

Parameters

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

Returns

ResultSet
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\Campaign
# 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\Campaign
- updated campaign
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\Tracking\TrackingActivity
# getEmailCampaignSends( string $accessToken, mixed $campaign, mixed $param = null )

Get sends for a campaign

Get sends for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

Get bounces for a campaign

Get bounces for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

Get opens for a campaign

Get opens for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

Get forwards for a campaign

Get forwards for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

Get unsubscribes for a campaign

Get unsubscribes for a campaign

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token
$campaign
mixed
$emailCampaign - Campaign id or Campaign object itself
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

ResultSet
- Containing a results array of Ctct\Components\CampaignTracking\OptOutActivity
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
$emailCampaign - Campaign id or Campaign object itself

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

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

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
$param
mixed
$param - either the next link from a previous request, or a limit or restrict the page size of an initial request

Returns

Ctct\Components\Tracking\TrackingActivity
- Containing a results array of Ctct\Components\Tracking\OptOutActivity
public array
# getVerifiedEmailAddresses( string $accessToken )

Get verified addresses for the account

Get verified addresses for the account

Parameters

$accessToken
string
$accessToken - Constant Contact OAuth2 access token

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
public array
# 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

array
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
Appconnect PHP SDK API documentation generated by ApiGen 2.8.0