0

I am trying to build a simple email application using Javascript to go against either the ExactTarget SOAP or REST API. Our goal is to use only Exact Target to build email templates and then send those email templates to a list of subscribers (passed in via an array or JSON object). My question is does the ExactTarget API even have the ability to do this? From what I have seen the only option is sendDefinitions or TriggeredEmails none of which are the type of functionality we are looking for. If the functionality exists what is the API endpoint I would hit and what would the body look like?

2

Welcome to SFSE. This is a really broad topic and can go many different directions. Let start with a few terminology things:

  • An Email Template an is an email model consisting of HTML, CSS & AMPScript defined with content placeholders that can vary in the Email Definition
  • The Email Definition can be based on a template or contain raw HTML CSS and AMPScript. These can be deployed as a Test Send or via the Guided Send process.
  • The Email Send Definition is also known as a User-Initiated Send. A Send Definition is the combination of an Email Definition and a predefined audience (List, Filter or Data Extension). These can be deployed manually, scheduled in an Automation or executed via API.
  • A Triggered Send is an Email Definition configured to accept an audience payload and executed via API call only.

Here are how the terminology above maps to the SOAP API Objects:

  • Email Send Definition is a EmailSendDefinition Object, sent using the Perform method
  • Email Definition is an Email Object and can be created using a Create method
  • Triggered Send is a TriggeredSend Object that references a TriggeredSendDefinition Object. These are executing using the Create method on the TriggeredSend Object. TriggeredSends are always queued in the platform and then sent one at a time.

In the scenario you described, it sounds like a Triggered Send is the best option. Here's what you need to do:

In the SFMC Platform

(Technically you can do all of these things with the API, but I would not recommend it.)

  1. Create an Email Definition (or Email Template + Email Definition).
  2. Create a Triggered Send Data Extension based on the Trigger Data Extension Template (to hold the payload sent from your API call). This is not to be confused with an Email Template.
  3. Create a Triggered Send Definition in Interactions that references your Email Definition. Make sure it's logging the payloads to the Data Extension you defined in Step 2.
  4. Publish the Trigger

In your development environment

  1. Using the API, create an API request on the TriggeredSend object, referencing your Triggered Send Definition by CustomerKey (aka External Key).

Here's a sample SOAP envelope:

<CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
    <Objects xsi:type="TriggeredSend">
       <Client>
          <ID><!-- YOUR ACCOUNT'S MID --></ID>
     </Client>
  <PartnerKey xsi:nil="true"/>
      <ObjectID xsi:nil="true"/>
           <TriggeredSendDefinition>
                <PartnerKey xsi:nil="true"/>
               <ObjectID xsi:nil="true"/>
              <CustomerKey><!-- CUSTOMER/EXTERNAL KEY FROM TSD --></CustomerKey>
         </TriggeredSendDefinition>
         <Subscribers>
             <PartnerKey xsi:nil="true"/>
             <ObjectID xsi:nil="true"/>
             <EmailAddress>email@example.com</EmailAddress>
             <SubscriberKey>email@example.com</SubscriberKey>    
             <Attributes>
                <Name>FirstName</Name>
                <Value><![CDATA[John]]></Value>
             </Attributes>
             <!-- MORE ATTRIBUTES NODES HERE --> 
             <!-- THESE WILL BE WRITTEN TO TS DATA EXTENSION IF NAMES MATCH COLUMNS -->
        </Subscribers>
    </Objects>
</CreateRequest>

More SOAP samples can be found here. The REST API call to do this is similar.

  • This is great information thank you for the quick reply! I was wondering if you could possibly give an example of manually sending a 'User-Initiated-Send' via the REST API. I have configured the User Initiated Send in Exact Target (I currently only have basic so Triggered Sends are not available). I feel what I want to do is pretty basic now that I have this information.... fire off a User Initiated Send using the External Key associated with it. I do not need to schedule in the future but can use the 'Start immediately, run once' feature. – Dadles May 26 '16 at 17:55
  • I would also need the REST API call for getting all user-initiated sends in that currently exist in exact target. I'm thinking I will start with a drop-down menu with the user-initiated sends and send button to send the emails immediately. – Dadles May 26 '16 at 17:59
  • I don't believe there's a REST API call for UI Sends...so SOAP is it. The SOAP API is more complete anyway. You'll have to get the subscribers into the sending data source first, ensure that process is complete and then perform the UI send. – Adam Spriggs May 26 '16 at 18:10
  • @Adam Spriggs : How to modify the FromAddress while trigger send? I have created question. salesforce.stackexchange.com/questions/140992/… – Unknown Sep 18 '16 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.