Jump to content

SendCampaignToSegment()

Send a pre-defined email campaign to a list segment.

Parameters

ApiKey (Required)
    Your application authentication key. Click here to find out more.
SegmentID (Required)
    The segment you would like to send to. Click here to find out more.
CampaignID (Required)
    The id of the email campaign you would like to send.  Note: in API version 1, this parameter was named EmailID.  Click here to find out more.

Fault Codes

1 - Invalid Email Address
    The email value is malformed or invalid
2 - Subscriber Already Exists
    The email already exists in the specified list
20 - Invalid SegmentID
    The Associated Segment is not valid
100 - Invalid API Key
    The API key is not valid or expired
400 - Invalid Custom Field
    The supplied custom field is invalid or does not exist

SOAP Sample Request


    
    
        
            
                STRING
                INT
                INT
            
        
    

SOAP Sample Response


    
    
        
            
                INT
                STRING
            
        
    

Code Sample - PHP

// Import the eConnect Email API Toolkit
require_once('eConnectEmail_API_Toolkit.php');

$eConnectEmailApi = TheKeyMakerClient('YOUR_API_KEY');

$result = $eConnectEmailApi->SendCampaignToSegment(SEGMENT_ID, CAMPAIGN_ID);

// Show the results
print 'Response: <pre>';
print_r($result);
print '</pre>';

Code Sample - ASP.NET C#

            TheKeyMaker_v20 api = new TheKeyMaker_v20();
            // Set up input parameters
            SendCampaignToSegmentParams cmpSegmentParams = new SendCampaignToSegmentParams();
            cmpSegmentParams.ApiKey = txtApiKey.Text;
            cmpSegmentParams.SegmentID = int.Parse(txtSendCampSegmentSegmentID.Text);
            cmpSegmentParams.CampaignID = int.Parse(txtSendCampSegmentCampaignID.Text);

            // Invoke method and store result
            CodeReturnValues sndcmpReturn = api.SendCampaignToSegment(cmpSegmentParams);

            // Display results
            lblResult.Text = FormatValue("Code", sndcmpReturn.Code.ToString())
                + FormatValue("Response", sndcmpReturn.Response);