Campaign

The campaign service allows for listing, creating and alteration of campaigns. Campaigns are positioned within Folders in the hierarchy.

Campaign Data

This is a listing of all the data for a campaign. When using one of the methods that returns campaign data, you will receive the majority of these. The ones marked 'Yes' in the 'Writeable' columns are values that can be written through the #insert or #update methods.

Name

Type

Writeable

Description

Note

campaign_id

int


Campaign's unique identifier


folder_id

int

Yes

The folder to which the campaign belongs


name

string

Yes

The name of the campaign


type

string

Yes

The setting for the campaign type

See #type

list_total

int


The list total for the campaign.

This is calculated on request and is based on lists assigned and segmentation applied.

update_ts

timestamp


Date and time the list was last updated.


type

This controls the campaign type.

A standard campaign is invisible in the interface, and SHOULD NOT be created through this service. Instead please see email_campaign.insert

Value

Description

standard

default A standard campaign, containing a single email campaign

variable

A split test campaign, allowed to contain multiple email campaigns



fetchAll

array campaign.fetchAll( int folderId )

Lists all campaigns under specified folder

Parameters

folder_id

ID of the folder you want to retrive the campigns from.

Return Values

Returns an associative array. For the possible returned elements see #Campaign Data.



find

array campaign.find( int campaignId )

Details the campaign

Parameters

campaignId

ID of the campaign you want the details from.

Return Values

Returns an associative array. For the possible returned elements see #Campaign Data.



insert

int campaign.insert( array data )

Inserts a new campaign under the specified folder

data

Name

Required

Type

Description

name

yes

string

Name of the campaign

folder_id

yes

int

Folder Id to attach the campaign to

type

no

string

standard [default], variable

Return Values

Returns an int value of the new campaign id.



update

bool campaign.update( int campaignId , array data )

Updates an existing campaign.

Parameters

campaignId

ID of the campaign you are updating.

data

See #insert

Return Values

Returns a boolean value of the status of the update.



delete

bool campaign.delete( int campaignId )

Deletes an existing campaign.

Parameters

campaignId

ID of the campaign you are deleting.

Return Values

Returns a boolean. True on success.



copy

array campaign.copy( int campaignId, string name, int folderId )

Copy an existing campaign to a new folder/name.

Parameters

campaignId

ID of the campaign to be copied.

name

Name of the new campaign.

folderId

ID of the folder where the new campaign should be created.

Return Values

Returns an int value of the new campaign id.



getAssignedLists

array campaign.getAssignedLists( int campaignId, string subset )

Retrieves a list of lists assigned to campaign.

Parameters

emailId

ID of the campaign.

subset

The subset of the lists to return:

Value

Description

all

default All assigned lists

include

Assigned include lists

exclude

Assigned exclude lists

Return Values

Returns an indexed array of associative arrays for each list assigned to the email. See below for elements returned:

Key

Type

Description

id

int

the list's unique system identifier

text

string

the list's name

listType

string

include or exclude

listTotal

int

uncalculated list total



setAssignedLists

array campaign.setAssignedLists( int campaignId, array lists )

Sets the list assignment for the campaign.

Parameters

campaignId

ID of the campaign.

lists

An indexed array of list IDs to be assigned to the campaign. These lists can be any existing list on the system, regardless of list type.

Return Values

Returns boolean true.



getAssignedSegments

array campaign.getAssignedSegments( int campaignId )

Retrieves a list of segments assigned to email.

Parameters

campaignId

ID of the campaign.

Return Values

Returns an indexed array of associative arrays for each segment assigned to the email. See below for elements returned:

Key

Type

Description

id

int

the segment's unique system identifier

text

string

the segment's name



setAssignedSegments

array campaign.setAssignedSegments( int campaignId, array segments )

Sets the segment assignment for the campaign.

Parameters

campaignId

ID of the campaign.

lists

An indexed array of segment IDs to be assigned to the email.

Return Values

Returns boolean true.



calculateListTotal

bool campaign.calculateListTotal( int campaignId )

Calculates the total number of recipients the campaign will be sent to based on the include, exclude and segmentation applied.

Parameters

campaignId

The ID of the campaign.

Return Values

Returns a bool. True on success.



getListTotal

int campaign.getListTotal( int campaignId )

Returns the total number of recipients the campaign will be sent to based on the include, exclude and segmentation applied.

Parameters

campaignId

The ID of the campaign.

Return Values

Returns a number of recipients being sent to. There are some special values for consideration:

Value

Description

-1

The list total is still being calculated

-2

The list total hasn't been calculated

Service

campaign

Methods