Jump to content

GetCampaignSubscribers()

Retrieves a list of subscribers who were sent the specified email campaign. Returns a maximum of 200 campaigns at a time.

Parameters

ApiKey (Required)
    Your application authentication key. Click here to find out more.

CampaignReportID (Optional)
    The ID number of the sent email campaign, as seen in the Reports tab.Click here to find out more.

StartIndex (Optional)
    The zero-based index offset at which to start listing the results. If left blank, the list will start at index 0 (i.e. the beginning).

Return Value

On success, this method returns the following information:

  • Subscriber Count - the total number of subscribers who were sent the campaign
  • Subscribers - an array listing the subscribers that clicked each link, and how often:
        Email - the email address of the subscriber
        ListID - the ID of the list to which the subscriber belongs
        Opens - the number of times the subscriber has opened the email
        Clicks - the number of links the subscriber has clicked
        Bounced - bounce status of the subscriber, if applicable; blank if never bounced,
                            "hard" if hard-bounced, or "soft" if soft-bounced
        Unsubscribed - 1 if unsubscribed, 0 if still subscribed

On failure, a SOAP fault exception is thrown with one of the fault codes below.

Usage Notes

Note that CampaignReportID values are not the same as CampaignID values. CampaignReportIDs are retrieved from the Reports tab, as explained here.

Fault Codes

100 - Invalid API Key
    The API key is not valid or expired

SOAP Sample Request


    
    
        
            
                STRING
                INT
                INT
            
        
    

SOAP Sample Response


    
    
        
            
                INT
                
                    <item>
                        <Email>STRING</Email>
                        <ListID>INT</ListID>
                        <Opens>INT</Opens>
                        <Clicks>INT</Clicks>
                        <Unsubscribed>INT</Unsubscribed>
                        <Bounced>STRING</Bounced>
                    </item>
                    <item> ... </item>
                
            
        
    

Code Sample - PHP

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

$eConnectEmailApi = TheKeyMakerClient('YOUR_API_KEY');

$result = $eConnectEmailApi->GetCampaignSubscribers(CAMPAIGN_ID, START_INDEX);

// 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
            CampaignSubscribersParams csParams = new CampaignSubscribersParams();
            csParams.ApiKey = txtApiKey.Text;
            csParams.CampaignReportID = int.Parse(txtGCSCampaignReportID.Text);
            csParams.StartIndex = (txtGCSStartIndex.Text.Trim() == "" ? 0 : int.Parse(txtGCSStartIndex.Text));

            // Invoke method and store result
            ReturnCampaignSubscribers campaignSubs = api.GetCampaignSubscribers(csParams);

            // Display results
            lblResult.Text = FormatValue("Total # of Subscribers", campaignSubs.SubscriberCount.ToString());
            lblResult.Text += "

Showing " + campaignSubs.Subscribers.Length.ToString() + " subscribers starting at index " + csParams.StartIndex.ToString() + "):

"; if (campaignSubs.Subscribers.Length > 0) { lblResult.Text += "" + ""; foreach (CampaignSubscriberResult subscriber in campaignSubs.Subscribers) { lblResult.Text += ""; } lblResult.Text += "
EmailListIDOpensClicksBounced?Unsubscribed?
" + subscriber.Email + "" + subscriber.ListID.ToString() + "" + subscriber.Opens.ToString() + "" + subscriber.Clicks.ToString() + "" + subscriber.Bounced + "" + subscriber.Unsubscribed + "
"; } else { lblResult.Text += "no subscribers match the specified criteria."; }