ExactTarget for Appexchange API Guide

From $1

    Doc-Wiki-BannerHK.png

    (Click the banner to go to the related Docs.Code.ExactTarget.com page.)

    This guide presents the details needed to use the capabilities of ExactTarget for AppExchange via a SOAP (Simple Object Access Protocol) web service in your business application.

    Page ID: 13401

    Prerequisites

    To begin to use these capabilities, your ExactTarget account must be fully configured for ExactTarget for AppExchange. .NET 2.0 (C#) is used as the language for code samples.

    About ExactTarget for AppExchange

    The ExactTarget for AppExchange API enables email to be sent to Salesforce.com reports, campaigns, contacts, or leads from ExactTarget via a SOAP web service. Opportunities to leverage ExactTarget for AppExchange's robust email sending and tracking capabilities together with Salesforce data in your business processes allow your business to access and record previously unreachable customer touch points.

    The ExactTarget for AppExchange API web service supports many business scenarios. The architecture of the web service allows many requests for ExactTarget for AppExchange send in a single call. Additionally, a send can consist of many Salesforce entities providing support for sophisticated business processes and marketing workflows.

    Some scenarios that would benefit from this feature follow:

    • A custom landing page that sends an individual confirmation email to a Salesforce.com Lead or Contact
    • A Salesforce.com workflow that sends individual email based on Salesforce.com data events
    • Sending mass email to one or many Salesforce.com Campaigns or Reports on a recurring basis triggered from an external application
    • An application that creates an ExactTarget email based on Salesforce templates and sends an the email to Salesforce.com entities.

    Working with ExactTarget for AppExchange API

    Accessing the Integration Framework Web Service

    In order to access the ExactTarget for AppExchange web service, you must first contact your ExactTarget account manager to configure your account and create a service user. A service user is a combination of user permissions and user settings. A user in your account is given permissions to access the web service and has the API User setting checked. Users who have the API User setting checked are not subject to the account's security settings.

    WSDL File

    Your development environment should access the ExactTarget for Appexchange WSDL file at https://etappx.exacttarget.com/etframeworksf.wsdl.

    ExactTarget maintains two web service addresses for use with the ExactTarget for AppExchange SOAP web service. Use the correct address for your ExactTarget instance, and contact your ExactTarget representative if you have any questions regarding which WSDL file you should use.

    The ExactTarget for Appexchange WSDL service is located at https://etappx.exacttarget.com/Service.asmx. If you use the S4 instance, use the address https://etappx.s4.exacttarget.com/Service.asmx. If you use the S6 instance, use the address https://etappx.s6.exacttarget.com/Service.asmx.

    These files define the objects and calls exposed to SOAP clients to interact with ExactTarget.

    Security

    Authenticating to the ExactTarget Integration Framework requires passing a WS-Security 1.0 security token in the SOAP header.

    Development Platform Support For WS-Security 1.0*

    Platform Library/Module
    C++ Axis2/C
    Java Axis2, XFire
    .NET WSE 3.0
    Perl WSRF::Lite
    PHP soap-wsse.php, Axis2, Instantsvc
    Python pyGridWare
    Ruby wss4r

    *This list is for information only and does not represent supported platforms.

    Developing against the ExactTarget for AppExchange API

    This section provides code samples and guidance for developing against the ExactTarget for AppExchange API.

    .NET/C#

    This section presents a sample C# application to show the five required steps for sending a ExactTarget for AppExchange email. This example demonstrates the invocation and subsequent handling of API calls.

    The result of all calls resulting in a outbound email are:

    • Email sent by ExactTarget contains personalization and dynamic content driven by Salesforce data mapped to ExactTarget attributes.
    • Email results are tracked in ExactTarget and Salesforce.
    Using the Create call to Send an Email

    This example uses a Create call to send a pre-existing ExactTarget email to recipients who reside on a Salesforce.com report:

    1. Establish secure authentication with ExactTarget.
    2. Specify an ExactTarget email using the email ID.
    3. Specify a target. Only one is specified by this call, but it contain many types of targets:
      • Salesforce ID is the ID of the Salesforce object.
      • Salesforce object type is the type of Salesforce object.
    4. Create a SalesforceSend object.
      • Sets Targets
      • Sets From Name (Optional)
      • Sets From Address (Optional)
      • Sets Targets to exclude from send (Optional)
    5. Send the SalesforceSend object into the web service Create call.
    6. Print result of the Create call to the console.
    Listing 1: Sending an ExactTarget Email to a Salesforce Report
    using System;
    
    using System.Collections.Generic;
    
    using System.Text;
    
    using System.Diagnostics;
    
    using System.Configuration;
    
    using Microsoft.Web.Services3.Design;
    
    using Microsoft.Web.Services3.Security.Tokens;
    
    using et.integrationframework.sf.etForAppX;
    
    namespace et.integrationframework.sf.unittests
    
    {
    
    public class SalesforceSendTest
    
    {
    
    string status = null; // overall status flag
    
    string requestID = null;
    
    /// <summary>
    
    /// Sends a ExactTarget for AppExchange email
    
    /// </summary>
    
    public void SendSalesforceEmail()
    
    {
    
    // 1. Initialize the web service proxy
    
    PartnerAPIWse etForAppx = new PartnerAPIWse();
    
    // 1a. Set the username/password. This is using the Username token of WS-Security 1.0
    
    UsernameTokenProvider utp = new UsernameTokenProvider(<username>, <password>);
    
    etForAppx.SetClientCredential<UsernameToken>(utp.GetToken());
    
    // 1b. Declare the policy
    
    policy = new Policy(new UsernameOverTransportAssertion());
    
    etForAppx.SetPolicy(policy);
    
    // 2. Specify the email to be sent
    
    Email email = new Email();
    
    email.ID = 3079342; // The ExactTarget ID of the email 
    
    email.IDSpecified = true; 
    
    // 3. Specify the report to be receive the email
    
    Target sfReport = new Target();
    
    sfReport.ObjectID = "00O60000001PWEy";
    
    sfReport.ObjectType = ObjectTypes.Report;
    
    // 4. Create a SalesforceSend object
    
    SalesforceSend sfs = new SalesforceSend();
    
    sfs.Email = email;
    
    sfs.Targets = new Target[] { sfReport };
    
    sfs.FromName = "From Name";
    
    sfs.FromAddress = "fromaddress@yourdomain.com";
    
    // 5. Create a SalesforceSend object
    
    CreateResult[] results = etForAppx.Create(new CreateOptions(), new APIObject[] { sfs }, out requestID, out status);
    
    // 6. Print out overall results
    
    Console.WriteLine(string.Format("Overall result: {0}. RequestID: {1}. Result Message: {2}", status, requestID, results[0].StatusMessage));
    
    }
    
    }
    
    }

    PHP

    The sample code below demonstrates how to connect your PHP development environment to the WSDL file.

    <?php 
    require('soap-wsse.php');
    
    class ExactTargetSoapClient extends SoapClient {
        public $username = NULL;
        public $password = NULL;
    
        function __doRequest($request, $location, $saction, $version) {
            $doc = new DOMDocument();
            $doc->loadXML($request);
    
            $objWSSE = new WSSESoap($doc);
    
            $objWSSE->addUserToken($this->username, $this->password, FALSE);
            return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
         }
    }
    
    class ExactTarget_APIObject {
      public $Client; // ExactTarget_ClientID
      public $PartnerProperties; // ExactTarget_APIProperty
      public $CreatedDate; // dateTime
      public $ModifiedDate; // dateTime
      public $ID; // int
      public $ObjectID; // string
      public $CustomerKey; // string
      public $Owner; // ExactTarget_Owner
      public $CorrelationID; // string
    }
    
    class ExactTarget_ClientID {
      public $ClientID; // int
      public $ID; // int
      public $PartnerClientKey; // string
      public $UserID; // int
      public $PartnerUserKey; // string
      public $CreatedBy; // int
      public $ModifiedBy; // int
      public $EnterpriseID; // long
    }
    
    class ExactTarget_APIProperty {
      public $Name; // string
      public $Value; // string
    }
    
    class ExactTarget_Owner {
      public $Client; // ExactTarget_ClientID
      public $FromName; // string
      public $FromAddress; // string
    } 
    class ExactTarget_AsyncResponseType {
      const None='None';
      const email='email';
      const FTP='FTP';
      const HTTPPost='HTTPPost';
    }
    
    class ExactTarget_AsyncResponse {
      public $ResponseType; // ExactTarget_AsyncResponseType
      public $ResponseAddress; // string
      public $RespondWhen; // ExactTarget_RespondWhen
      public $IncludeResults; // boolean
      public $IncludeObjects; // boolean
      public $OnlyIncludeBase; // boolean
    }
    
    class ExactTarget_ContainerID {
      public $APIObject; // ExactTarget_APIObject
    }
    
    class ExactTarget_Request {
    }
    
    class ExactTarget_Result {
      public $StatusCode; // string
      public $StatusMessage; // string
      public $OrdinalID; // int
      public $ErrorCode; // int
      public $RequestID; // string
      public $ConversationID; // string
      public $OverallStatusCode; // string
      public $RequestType; // ExactTarget_RequestType
      public $ResultType; // string
      public $ResultDetailXML; // string
    }
    
    class ExactTarget_Priority {
      const Low='Low';
      const Medium='Medium';
      const High='High';
    } 
    class ExactTarget_Options {
      public $Client; // ExactTarget_ClientID
      public $SendResponseTo; // ExactTarget_AsyncResponse
      public $SaveOptions; // ExactTarget_SaveOptions
      public $Priority; // byte
      public $ConversationID; // string
      public $SequenceCode; // int
      public $CallsInConversation; // int
      public $ScheduledTime; // dateTime
      public $RequestType; // ExactTarget_RequestType
      public $QueuePriority; // ExactTarget_Priority
    }
    
    class ExactTarget_SaveOptions {
      public $SaveOption; // ExactTarget_SaveOption
    }
    
    class ExactTarget_TaskResult {
      public $StatusCode; // string
      public $StatusMessage; // string
      public $OrdinalID; // int
      public $ErrorCode; // int
      public $ID; // string
      public $InteractionObjectID; // string
    }
    
    class ExactTarget_RequestType {
      const Synchronous='Synchronous';
      const Asynchronous='Asynchronous';
    }
    
    class ExactTarget_RespondWhen {
      const Never='Never';
      const OnError='OnError';
      const Always='Always';
      const OnConversationError='OnConversationError';
      const OnConversationComplete='OnConversationComplete';
      const OnCallComplete='OnCallComplete';
    }
    
    class ExactTarget_SaveOption {
      public $PropertyName; // string
      public $SaveAction; // ExactTarget_SaveAction
    }
    
    class ExactTarget_SaveAction {
      const AddOnly='AddOnly';
      const _Default='Default';
      const Nothing='Nothing';
      const UpdateAdd='UpdateAdd';
      const UpdateOnly='UpdateOnly';
      const Delete='Delete';
    }
    
    class ExactTarget_CreateRequest {
      public $Options; // ExactTarget_CreateOptions
      public $Objects; // ExactTarget_APIObject
    }
     class ExactTarget_CreateResult {
      public $NewID; // int
      public $NewObjectID; // string
      public $Object; // ExactTarget_APIObject
      public $CreateResults; // ExactTarget_CreateResult
      public $ParentPropertyName; // string
    }
    
    class ExactTarget_CreateResponse {
      public $Results; // ExactTarget_CreateResult
      public $RequestID; // string
      public $OverallStatus; // string
    }
    
    class ExactTarget_CreateOptions {
      public $Container; // ExactTarget_ContainerID
    }
    
    class ExactTarget_UpdateOptions {
      public $Container; // ExactTarget_ContainerID
      public $Action; // string
    }
    
    class ExactTarget_UpdateRequest {
      public $Options; // ExactTarget_UpdateOptions
      public $Objects; // ExactTarget_APIObject
    }
    
    class ExactTarget_UpdateResult {
      public $Object; // ExactTarget_APIObject
      public $UpdateResults; // ExactTarget_UpdateResult
      public $ParentPropertyName; // string
    }
    
    class ExactTarget_UpdateResponse {
      public $Results; // ExactTarget_UpdateResult
      public $RequestID; // string
      public $OverallStatus; // string
    }
    
    class ExactTarget_Locale {
      public $LocaleCode; // string
    }
    
    class ExactTarget_Email {
      public $Name; // string
      public $Folder; // string
      public $CategoryID; // int
      public $HTMLBody; // string
      public $TextBody; // string
      public $ContentAreas; // ExactTarget_ContentArea
      public $Subject; // string
      public $IsActive; // boolean
      public $IsHTMLPaste; // boolean
      public $ClonedFromID; // int
      public $Status; // string
      public $EmailType; // string
      public $CharacterSet; // string
      public $HasDynamicSubjectLine; // boolean
      public $ContentCheckStatus; // string
    }
    
    class ExactTarget_ContentArea {
      public $Key; // string
      public $Content; // string
      public $IsBlank; // boolean
      public $CategoryID; // int
      public $Name; // string
      public $Layout; // ExactTarget_LayoutType
      public $IsDynamicContent; // boolean
      public $IsSurvey; // boolean
    }
    
    class ExactTarget_LayoutType {
      const HTMLWrapped='HTMLWrapped';
      const RawText='RawText';
      const SMS='SMS';
    }
    
    class ExactTarget_Subscriber {
      public $EmailAddress; // string
      public $Attributes; // ExactTarget_Attribute
      public $SubscriberKey; // string
      public $UnsubscribedDate; // dateTime
      public $Status; // ExactTarget_SubscriberStatus
      public $PartnerType; // string
      public $EmailTypePreference; // ExactTarget_EmailType
      public $Lists; // ExactTarget_SubscriberList
      public $GlobalUnsubscribeCategory; // ExactTarget_GlobalUnsubscribeCategory
      public $SubscriberTypeDefinition; // ExactTarget_SubscriberTypeDefinition
      public $Addresses; // ExactTarget_Addresses
      public $PrimarySMSAddress; // ExactTarget_SMSAddress
      public $PrimarySMSPublicationStatus; // ExactTarget_SubscriberAddressStatus
      public $PrimaryEmailAddress; // ExactTarget_EmailAddress
      public $Locale; // ExactTarget_Locale
    }
    
    class ExactTarget_Addresses {
      public $Address; // ExactTarget_SubscriberAddress
    }
    
    class ExactTarget_Attribute {
      public $Name; // string
      public $Value; // string
      public $Compression; // ExactTarget_CompressionConfiguration
    }
    
    class ExactTarget_CompressionConfiguration {
      public $Type; // ExactTarget_CompressionType
      public $Encoding; // ExactTarget_CompressionEncoding
    }
    
    class ExactTarget_CompressionType {
      const gzip='gzip';
    }
     class ExactTarget_CompressionEncoding {
      const base64='base64';
    }
    
    class ExactTarget_SubscriberStatus {
      const Active='Active';
      const Bounced='Bounced';
      const Held='Held';
      const Unsubscribed='Unsubscribed';
      const Deleted='Deleted';
    }
    
    class ExactTarget_SubscriberTypeDefinition {
      public $SubscriberType; // string
    }
    
    class ExactTarget_EmailType {
      const Text='Text';
      const HTML='HTML';
    }
    
    class ExactTarget_SubscriberList {
      public $Status; // ExactTarget_SubscriberStatus
      public $List; // ExactTarget_List
      public $Action; // string
      public $Subscriber; // ExactTarget_Subscriber
    }
     class ExactTarget_List {
      public $ListName; // string
      public $Category; // int
      public $Type; // ExactTarget_ListTypeEnum
      public $Description; // string
      public $Subscribers; // ExactTarget_Subscriber
      public $ListClassification; // ExactTarget_ListClassificationEnum
    }
     class ExactTarget_ListTypeEnum {
      const _Public='Public';
      const _Private='Private';
      const SalesForce='SalesForce';
      const GlobalUnsubscribe='GlobalUnsubscribe';
      const Master='Master';
    }
     class ExactTarget_ListClassificationEnum {
      const ExactTargetList='ExactTargetList';
      const PublicationList='PublicationList';
      const SuppressionList='SuppressionList';
    }
    
    class ExactTarget_Group {
      public $Name; // string
      public $Category; // int
      public $Description; // string
      public $Subscribers; // ExactTarget_Subscriber
    }
    
    class ExactTarget_GlobalUnsubscribeCategory {
      public $Name; // string
      public $IgnorableByPartners; // boolean
      public $Ignore; // boolean
    }
    
    class ExactTarget_ObjectTypes {
      const Lead='Lead';
      const Contact='Contact';
      const Campaign='Campaign';
      const Report='Report';
    }
    
    class ExactTarget_Target {
      public $ObjectType; // ExactTarget_ObjectTypes
      public $Filters; // ExactTarget_Filters
    }
    
    class ExactTarget_Filters {
      public $Filter; // ExactTarget_APIProperty
    }
    
    class ExactTarget_SalesforceSend {
      public $Email; // ExactTarget_Email
      public $SendDate; // dateTime
      public $FromAddress; // string
      public $FromName; // string
      public $Subject; // string
      public $IsMultipart; // boolean
      public $IndividualResults; // boolean
      public $Targets; // ExactTarget_Target
      public $Exclusions; // ExactTarget_Target
    }
    
    class ExactTarget_SubscriberAddress {
      public $AddressType; // string
      public $Address; // string
      public $Statuses; // ExactTarget_Statuses
    }
    
    class ExactTarget_Statuses {
      public $Status; // ExactTarget_AddressStatus
    }
    
    class ExactTarget_SMSAddress {
      public $Carrier; // string
    }
    
    class ExactTarget_EmailAddress {
      public $Type; // ExactTarget_EmailType
    }
    
    class ExactTarget_AddressStatus {
      public $Status; // ExactTarget_SubscriberAddressStatus
    }
    
    class ExactTarget_SubscriberAddressStatus {
      const OptedIn='OptedIn';
      const OptedOut='OptedOut';
      const InActive='InActive';
    } 
    ?>
    When sending a message to a Contact or Lead, set the IndividualResults property to true if you want individual email results to show in your Salesforce instance.
     The sample code below demonstrates how to create a Salesforce send through the API.
    <?php 
    require('exacttarget_appexchange_soap_client.php');
    
    $wsdl = 'https://etappx.exacttarget.com/etframeworksf.wsdl';
    
    try{
            /* Create the Soap Client */
            $client = new ExactTargetSoapClient($wsdl, array('trace'=>1));
    
            /* Set username and password here */
            $client->username = 'xxx';
            $client->password = 'xxx';
            //Setup the Email Send Definition
                 $SFSend = new ExactTarget_SalesforceSend();
                 $email = new ExactTarget_Email();
                 $email->ID = '3099626';
                 $SFSend->Email = $email;
                 $SFSend->FromAddress = 'help@exacttarget.com';
                 $SFSend->FromName = 'MAC'; 
                 $contact = new ExactTarget_Target();
                 $contact->ObjectID = '003A000000A7kKBIAZ';
                 $contact->ObjectType = 'Contact';
    
                 $SFSend->Targets = array(new SoapVar($contact, SOAP_ENC_OBJECT, 'Target', "http://exacttarget.com/wsdl/partnerAPI"));
    
                 $object = new SoapVar($SFSend, SOAP_ENC_OBJECT, 'SalesforceSend', "http://exacttarget.com/wsdl/partnerAPI");
    
                 $request = new ExactTarget_CreateRequest();
                 $request->Options = NULL;
                 $request->Objects = array($object);
    
                 $results = $client->Create($request);
    
                 var_dump($results);
    
    } catch (Exception $e) {
    echo 'Message: ' .$e->getMessage();
    }
    ?>

    ExactTarget for Appexchange API Methods, Objects, and Properties

    Click the links below to view the methods, objects, and properties associated with the ExactTarget for Appexchange API.

     


    This page was last updated by Ryan Williams on Tue, 24 Jan 2012 13:23:05 GMT.

    If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:

     


    Was This Page Helpful?
    Suggestions or Comments:
    Name (optional):
    Email Address (optional):
    Enter 14100 backwards:
       
    Tags: (Edit tags)
    • No tags
    FileSizeDateAttached by 
    salesforce.JPG
    No description
    26.23 kB09:23, 24 Jan 2012AdminActions
    Comments (0)
    You must login to post a comment.

     
    Powered by MindTouch 2010
    Admin