Declared in CSAPI+Campaigns.h

Overview

Campaign-related APIs. See CSAPI for documentation of the other API categories.

Tasks

Instance Methods

createCampaignFromTemplateWithClientID:name:subject:fromName:fromEmail:replyTo:listIDs:segmentIDs:templateID:templateContent:completionHandler:errorHandler:

Create a draft campaign using a template.

- (void)createCampaignFromTemplateWithClientID:(NSString *)clientID name:(NSString *)name subject:(NSString *)subject fromName:(NSString *)fromName fromEmail:(NSString *)fromEmail replyTo:(NSString *)replyTo listIDs:(NSArray *)listIDs segmentIDs:(NSArray *)segmentIDs templateID:(NSString *)templateID templateContent:(NSDictionary *)templateContent completionHandler:(void ( ^ ) ( NSString *campaignID ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

clientID

The ID of the client for whom the campaign should be created.

name

Name of the campaign

subject

Subject of the email

fromName

Senders name

fromEmail

Senders email address

replyTo

Email address to use in the Reply-To field

listIDs

Array of list IDs

segmentIDs

Array of segment IDs

templateID

The ID of the template which should be used to create the campaign.

templateContent

The content to be used for the editable areas of the template.

The structure of templateContent is important. If you wanted to provided content for the editable areas of the following HTML template:

<html>
    <head><title>My Template</title></head>
    <body>
        <p><singleline>Enter heading...</singleline></p>
        <div><multiline>Enter description...</multiline></div>
        <img id="header-image" editable="true" width="500" />
        <repeater>
            <layout label="My layout">
                <div class="repeater-item">
                <p><singleline></singleline></p>
                <div><multiline></multiline></div>
                <img editable="true" width="500" />
                </div>
            </layout>
        </repeater>
        <p><unsubscribe>Unsubscribe</unsubscribe></p>
    </body>
</html>

You could define templateContent as follows:

NSDictionary *templateContent = @{
    @"SingleLines": @[
        @{@"Content": @"This is a heading", @"Href": @"http://example.com/"}
    ],
    @"MultiLines": @[
        @{@"Content": @"<p>This is example</p><p>multiline <a href=\"http://example.com\">content</a>...</p>"}
    ],
    @"Images": @[
        @{@"Content": @"http://example.com/image.png", @"Alt": @"This is alt text for an image", @"Href": @"http://example.com/"}
    ],
    @"Repeaters": @[
        @{
            @"Items": @[
                @{
                    @"Layout": @"MyLayout",
                    @"SingleLines": @[
                        @{@"Content": @"This is a repeater heading", @"Href": @"http://example.com/"}
                    ],
                    @"MultiLines": @[
                        @{@"Content": @"<p>This is example</p><p>multiline <a href=\"http://example.com\">content</a>...</p>"}
                    ],
                    @"Images": @[
                        @{@"Content": @"http://example.com/image.png", @"Alt": @"This is alt text for a repeater image", @"Href": @"http://example.com/"}
                    ]
                }
            ]
        }
    ]
};

Be sure to check out http://www.campaignmonitor.com/api/campaigns/#creating_a_campaign_from_template for details of the structure of templateContent.

completionHandler

Completion callback, with ID of the successfully created campaign as the only argument

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#creating_a_campaign_from_template

Declared In

CSAPI+Campaigns.h

createCampaignWithClientID:name:subject:fromName:fromEmail:replyTo:htmlURL:textURL:listIDs:segmentIDs:completionHandler:errorHandler:

Create a draft campaign ready to be tested as a preview or sent.

- (void)createCampaignWithClientID:(NSString *)clientID name:(NSString *)name subject:(NSString *)subject fromName:(NSString *)fromName fromEmail:(NSString *)fromEmail replyTo:(NSString *)replyTo htmlURL:(NSString *)htmlURL textURL:(NSString *)textURL listIDs:(NSArray *)listIDs segmentIDs:(NSArray *)segmentIDs completionHandler:(void ( ^ ) ( NSString *campaignID ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

clientID

The ID of the client for whom the campaign should be created.

name

Name of the campaign

subject

Subject of the email

fromName

Senders name

fromEmail

Senders email address

replyTo

Email address to use in the Reply-To field

htmlURL

URL for the HTML content

textURL

URL for the plain text content (use an empty string if you want the plain text content to be generated from the HTML content)

listIDs

Array of list IDs

segmentIDs

Array of segment IDs

completionHandler

Completion callback, with ID of the successfully created campaign as the only argument

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#creating_a_draft_campaign

Declared In

CSAPI+Campaigns.h

deleteCampaignWithID:completionHandler:errorHandler:

Delete a campaign from your account

- (void)deleteCampaignWithID:(NSString *)campaignID completionHandler:(void ( ^ ) ( void ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign to delete

completionHandler

Completion callback

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#deleting_a_campaign

Declared In

CSAPI+Campaigns.h

getCampaignBouncesWithCampaignID:date:page:pageSize:orderField:ascending:completionHandler:errorHandler:

Get a paged result representing all the subscribers who bounced for a given campaign

- (void)getCampaignBouncesWithCampaignID:(NSString *)campaignID date:(NSDate *)date page:(NSUInteger)page pageSize:(NSUInteger)pageSize orderField:(NSString *)orderField ascending:(BOOL)ascending completionHandler:(void ( ^ ) ( CSPaginatedResult *paginatedResult ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for. You can get the ID by calling getSentCampaignsWithClientID:completionHandler:errorHandler:.

date

Bounces after the specified date will be returned

page

The page to retrieve

pageSize

The number of subscribers to retrieve per page. Values accepted are between 10 and 1000.

orderField

The subscriber field to order the list by. Values accepted are email, name or date.

ascending

Whether to sort the list (see orderField) in ascending order

completionHandler

Completion callback, with a CSPaginatedResult as the first and only argument. Items in the result list are CSCampaignBouncedRecipient

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_bounces

Declared In

CSAPI+Campaigns.h

getCampaignClicksWithCampaignID:date:page:pageSize:orderField:ascending:completionHandler:errorHandler:

Get a paged result representing all subscribers who clicked a link in the email for a given campaign

- (void)getCampaignClicksWithCampaignID:(NSString *)campaignID date:(NSDate *)date page:(NSUInteger)page pageSize:(NSUInteger)pageSize orderField:(NSString *)orderField ascending:(BOOL)ascending completionHandler:(void ( ^ ) ( CSPaginatedResult *paginatedResult ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for. You can get the ID by calling getSentCampaignsWithClientID:completionHandler:errorHandler:.

date

Clicks after the specified date will be returned

page

The page to retrieve

pageSize

The number of subscribers to retrieve per page. Values accepted are between 10 and 1000.

orderField

The subscriber field to order the list by. Values accepted are email, name or date.

ascending

Whether to sort the list (see orderField) in ascending order

completionHandler

Completion callback, with a CSPaginatedResult as the first and only argument. Items in the result list are CSCampaignRecipientClicked:

errorHandler

Error callback

Declared In

CSAPI+Campaigns.h

getCampaignEmailClientUsageWithCampaignID:completionHandler:errorHandler:

Gets the list of email clients used by subscribers to open the campaign.

- (void)getCampaignEmailClientUsageWithCampaignID:(NSString *)campaignID completionHandler:(void ( ^ ) ( NSArray *campaignEmailClientUsage ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign for which email client usage should be found.

completionHandler

Completion callback, with an array of CSCampaignEmailClient objects as the first and only argument

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_email_client_usage

Declared In

CSAPI+Campaigns.h

getCampaignListsAndSegmentsWithCampaignID:completionHandler:errorHandler:

Get the lists and segments a campaign was sent to

- (void)getCampaignListsAndSegmentsWithCampaignID:(NSString *)campaignID completionHandler:(void ( ^ ) ( NSArray *lists , NSArray *segments ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for

completionHandler

Completion callback, with an array of CSList objects as the first argument and an array of CSSegment objects as the second argument

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_lists_and_segments

Declared In

CSAPI+Campaigns.h

getCampaignOpensWithCampaignID:date:page:pageSize:orderField:ascending:completionHandler:errorHandler:

Get a paged result representing all subscribers who opened the email for a given campaign

- (void)getCampaignOpensWithCampaignID:(NSString *)campaignID date:(NSDate *)date page:(NSUInteger)page pageSize:(NSUInteger)pageSize orderField:(NSString *)orderField ascending:(BOOL)ascending completionHandler:(void ( ^ ) ( CSPaginatedResult *paginatedResult ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for. You can get the ID by calling getSentCampaignsWithClientID:completionHandler:errorHandler:.

date

Opens after the specified date will be returned

page

The page to retrieve

pageSize

The number of subscribers to retrieve per page. Values accepted are between 10 and 1000.

orderField

The subscriber field to order the list by. Values accepted are email, name or date.

ascending

Whether to sort the list (see orderField) in ascending order

completionHandler

Completion callback, with a CSPaginatedResult as the first and only argument. Items in the result list are CSCampaignRecipient

errorHandler

Error callback

Declared In

CSAPI+Campaigns.h

getCampaignRecipientsWithCampaignID:page:pageSize:orderField:ascending:completionHandler:errorHandler:

Get a paged result representing all the subscribers that a given campaign was sent to

- (void)getCampaignRecipientsWithCampaignID:(NSString *)campaignID page:(NSUInteger)page pageSize:(NSUInteger)pageSize orderField:(NSString *)orderField ascending:(BOOL)ascending completionHandler:(void ( ^ ) ( CSPaginatedResult *paginatedResult ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for. You can get the ID by calling getSentCampaignsWithClientID:completionHandler:errorHandler:.

page

The page to retrieve

pageSize

The number of subscribers to retrieve per page. Values accepted are between 10 and 1000.

orderField

The subscriber field to order the list by. Values accepted are email, name or date.

ascending

Whether to sort the list (see orderField) in ascending order

completionHandler

Completion callback, with a CSPaginatedResult as the first and only argument. Items in the result list are CSCampaignRecipient

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_recipients

Declared In

CSAPI+Campaigns.h

getCampaignSpamComplaintsWithCampaignID:date:page:pageSize:orderField:ascending:completionHandler:errorHandler:

Get a paged result representing all subscribers who marked a given campaign as spam

- (void)getCampaignSpamComplaintsWithCampaignID:(NSString *)campaignID date:(NSDate *)date page:(NSUInteger)page pageSize:(NSUInteger)pageSize orderField:(NSString *)orderField ascending:(BOOL)ascending completionHandler:(void ( ^ ) ( CSPaginatedResult *paginatedResult ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for. You can get the ID by calling getSentCampaignsWithClientID:completionHandler:errorHandler:.

date

Spam complaints after the specified date will be returned

page

The page to retrieve

pageSize

The number of subscribers to retrieve per page. Values accepted are between 10 and 1000.

orderField

The subscriber field to order the list by. Values accepted are email, name or date.

ascending

Whether to sort the list (see orderField) in ascending order

completionHandler

Completion callback, with a CSPaginatedResult as the first and only argument. Items in the result list are CSCampaignRecipient:

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_spam_complaints

Declared In

CSAPI+Campaigns.h

getCampaignSummaryWithCampaignID:completionHandler:errorHandler:

Get a basic summary of the results of a sent campaign

- (void)getCampaignSummaryWithCampaignID:(NSString *)campaignID completionHandler:(void ( ^ ) ( CSCampaignSummary *campaignSummary ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for

completionHandler

Completion callback, with a CSCampaignSummary object as the only argument

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_summary

Declared In

CSAPI+Campaigns.h

getCampaignUnsubscribesWithCampaignID:date:page:pageSize:orderField:ascending:completionHandler:errorHandler:

Get a paged result representing all subscribers who unsubscribed from the email for a given campaign

- (void)getCampaignUnsubscribesWithCampaignID:(NSString *)campaignID date:(NSDate *)date page:(NSUInteger)page pageSize:(NSUInteger)pageSize orderField:(NSString *)orderField ascending:(BOOL)ascending completionHandler:(void ( ^ ) ( CSPaginatedResult *paginatedResult ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign you want data for. You can get the ID by calling getSentCampaignsWithClientID:completionHandler:errorHandler:.

date

Unsubscribes after the specified date will be returned

page

The page to retrieve

pageSize

The number of subscribers to retrieve per page. Values accepted are between 10 and 1000.

orderField

The subscriber field to order the list by. Values accepted are email, name or date.

ascending

Whether to sort the list (see orderField) in ascending order

completionHandler

Completion callback, with a CSPaginatedResult as the first and only argument. Items in the result list are CSCampaignRecipient:

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#campaign_unsubscribes

Declared In

CSAPI+Campaigns.h

sendCampaignImmediatelyWithCampaignID:confirmationEmailAddress:completionHandler:errorHandler:

Schedule a draft campaign to be sent immediately

- (void)sendCampaignImmediatelyWithCampaignID:(NSString *)campaignID confirmationEmailAddress:(NSString *)emailAddress completionHandler:(void ( ^ ) ( void ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign to send

emailAddress

The email address that the confirmation email will be sent to

completionHandler

Completion callback

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#sending_a_draft_campaign

Declared In

CSAPI+Campaigns.h

sendCampaignPreviewWithCampaignID:recipients:personalize:completionHandler:errorHandler:

Send a preview of any draft campaign to a number of email addresses you specify. You can also set how we should treat any personalization tags in your draft campaign.

- (void)sendCampaignPreviewWithCampaignID:(NSString *)campaignID recipients:(NSArray *)recipients personalize:(NSString *)personalize completionHandler:(void ( ^ ) ( void ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign to send

recipients

A collection of intended recipients of the campaign preview.

personalize

Option to control personalization of the campaign preview. Only relevant when the campaign actually includes personalization tags. Valid variations are:

  • Fallback (Use the fallback terms.)
  • Random (Choose a random recipient from the lists and segments allocated to the campaign.)
  • A specific email address (Use the personalisation details attached to the email address. Only valid if the subscriber is a recipient of the campaign. The address will not be sent a copy of the email.)
completionHandler

Completion callback

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#sending_a_campaign_preview

Declared In

CSAPI+Campaigns.h

sendCampaignWithCampaignID:confirmationEmailAddress:sendDate:completionHandler:errorHandler:

Schedule a draft campaign to be sent at a custom date and time in the future

- (void)sendCampaignWithCampaignID:(NSString *)campaignID confirmationEmailAddress:(NSString *)emailAddress sendDate:(NSDate *)sendDate completionHandler:(void ( ^ ) ( void ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign to send

emailAddress

The email address that the confirmation email will be sent to

sendDate

The date and time the campaign should be scheduled to be sent

completionHandler

Completion callback

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#sending_a_draft_campaign

Declared In

CSAPI+Campaigns.h

unscheduleCampaignWithID:completionHandler:errorHandler:

Cancels the sending of the campaign and moves it back into the drafts. If the campaign is already sent or in the process of sending, this operation will fail.

- (void)unscheduleCampaignWithID:(NSString *)campaignID completionHandler:(void ( ^ ) ( void ))completionHandler errorHandler:(CSAPIErrorHandler)errorHandler

Parameters

campaignID

The ID of the campaign to be unscheduled.

completionHandler

Completion callback

errorHandler

Error callback

Discussion

http://www.campaignmonitor.com/api/campaigns/#unscheduling_a_campaign

Declared In

CSAPI+Campaigns.h