Service: CreateCampaign

The CreateCampaign service allows you to create a new campaign within Flexmail. The ID of the newly created Campaign will be returned to you.

Service Details

SOAP Action: CreateCampaign
SOAP Return Object: CreateCampaignResp

Input

The following table describes the parameters used for calling the CreateCampaign service.

Table: instance of CreateCampaignReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
campaignType Y CampaignType Campaign Type

Output

The following table describes the parameters returned from the CreateCampaign service.

Table: instance of CreateCampaignResp

Parameter Mandatory Type Description
header / APIResponseHeader Header containing authentication information
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error
campaignId / Integer Id of the new campaign

Table: response codes of CreateCampaignResp.

0 No error
220 Authentication error, see header object for detailed information
221 Campaign name is mandatory
222 Campaign subject is mandatory
223 Campaign sender email address is mandatory
224 Campaign sender name is mandatory
225 Campaign reply email address is mandatory
226 Campaign message id is mandatory
227 Campaign message is invalid
228 Campaign already exists
229 Campaign mailing list ids or group ids are mandatory
231 Campaign mailing list ids must be an array
232 Invalid mailing list id
232 Campaign group ids must be an array
234 Invalid group id
235 Invalid message id
236 Campaign name too long
237 Campaign subject too long

Example

This example shows you the creation of a new campaign within Flexmail, the name of our campaign is "my new Campaign".

<?php
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

$createCampaignReq->header = $header;
$createCampaignReq->campaignType->campaignName = "my new campaign";
$createCampaignReq->campaignType->campaignSubject = "Doe's weekly newsletter";
$createCampaignReq->campaignType->campaignSenderName = "Doe inc.";
$createCampaignReq->campaignType->campaignSenderEmailAddress = "john@doe.com";
$createCampaignReq->campaignType->campaignReplyEmailAddress = "john@doe.com";
$createCampaignReq->campaignType->campaignMessageId = 2315;
$createCampaignReq->campaignType->campaignMailingIds = array( 1046,1047);

$createCampaignResp = $SoapClient->__soapCall("CreateCampaign", array($createCampaignReq));

if ($createCampaignResp->errorCode == 0) {
	echo "Campaign created, the new campaign id=" . $createCampaignResp->campaignId;
}else{
	echo "Campaign creation failed: " . $createCampaignResp->errorMessage;
}
?>