SendCampaign

Sends a specified campaign to one or more address books, segments or contacts, either as an immediate or scheduled send

This method sends a specified campaign to as many address books and segments as you choose. However, when sending to contacts, you can only send to up to 10 in a single call. You can send to a single contact if you wish.

The send can also be scheduled by including the SendDate parameter. If the SendDate parameter isn't included, the campaign will be sent immediately.

If you want to send the campaign as a split test, you must include all the fields of the SplitTestOptions parameter. If the SplitTestOptions parameter isn't included, the campaign will not be sent as a split test.

The value of the TestPercentage field must be between 1 and 100.The value of the TestPeriodHours field must be between 1 and 2,147,483,647.

Please note that this method doesn't add to your allotted total calls in a 24 hour period.

SOAP action: http://apiconnector.com/v2/ApiService/SendCampaign

📘

Input and output parameters

The input and output parameters for this method are:

Input parameters

  • CampaignId - required; integer
  • AddressBooks - optional; array of integers
    • integer
  • ContactIds - optional; array of integers
    • integer
  • SendDate - optional; dateTime
  • SplitTestOptions - optional; object
    • TestMetric - string ('Opens', 'Clicks')
    • TestPercentage - integer
    • TestPeriodHours - integer

Output parameters

  • SendCampaignResult
    • Id - GUID
    • CampaignId - integer
    • AddressBooks - array of integers
      • integer
    • ContactIds - array of integers
      • integer
    • SendDate - dateTime
    • SplitTestOptions - object
      • TestMetric - string ('Opens', 'Clicks')
      • TestPercentage - integer
      • TestPeriodHours - integer
    • Status - string ('NotSent', 'Scheduled', 'Sending', 'Sent', 'Cancelled')

Example

using (var client = new ApiServiceClient())
{
	client.ClientCredentials.UserName.UserName = "username";
	client.ClientCredentials.UserName.Password = "password";

	// Note: You can send to AddressBookIds OR ContactIds, not both at the same time
	var campaignSend = new ApiCampaignSend
	                    {
	                        CampaignId = 1,
	                        AddressBookIds = new[] { 1, 2, 3 },
	                        ContactIds = new[] { 1, 2, 3 },
	                        SplitTestOptions = new ApiSplitTestSendOptions
	                                            {
	                                                TestMetric = ApiSplitTestMetrics.Clicks,
	                                                TestPercentage = 50,
	                                                TestPeriodHours = 12
	                                            },
	                        SendDate = new DateTime(2015, 01, 01, 00, 00, 00, DateTimeKind.Utc)
	                    };
	var updatedCampaignSend = client.SendCampaign(campaignSend);
}