I am having a hard time understanding ExactTarget's API.

Please, in the lamest terms, someone please explain to me the complete flow of using a trigger email.

Here is the scenario:

New customer comes to my websites, adds 4 products to their cart, then checks out.

After the customer checks out, I send him/her an email that contains the order's receipt.

Here is what I believe to be work flow:

Create a subscriber using

$subscriber = new ExactTarget_Subscriber();

Q1: How do I get the new SubscriberKey after I create the subscriber?

Create rows in DE using a combination of the following functions


Q2: How do I get the new Primary Key value for each row after I create them?

Now I get the triggerSend ready using these functions


Now here is where I get lost! What am I suppose to do now?

The triggerSend is pointing to a Template that is going to use values stored data extension rows

Q3: How do I identify the new subscriber I just created, and passed it to the triggerSend?

Q4: Do I want to handle pointing out what Data Extension Rows to use using the WEB API or do I do that in the Template using AMPScript?

Q5: Is My understanding of the way ExactTarget's system works, even correct?

  • This question covers a lot of topics, and is technically too broad to answer. However, have you followed this guide - Triggered Send Scenario for Developers? Most of the items you have listed above are covered. Commented Mar 24, 2014 at 12:15
  • Here is another overview that might be helpful - help.exacttarget.com/en/technical_library/web_service_guide/… Commented Mar 24, 2014 at 12:22
  • For Q1 and Q2, the Subscriber Key value is something that you would provide as a unique identifier for the subscriber, it is not something generated by ExactTarget. The same is true for the primary key value in a data extension, if a field in the data extension was defined as a primary key then the value passed for that field would be the primary key. It is not going to automatically generate a value for a primary key field.
    – Mac
    Commented Mar 24, 2014 at 12:48

1 Answer 1


I don't blame you for being confused. It's hard to know where to start and where to look with the Marketing Cloud API documentation.

In response to your questions:

A1: You specify the SubscriberKey in your API call.

A2: The primary key is determined by the Triggered Send Data Extension Template used to create the target Data Extension

A3: The subscriber is identified by the SubscriberKey

A4: You'll have the attributes passed in your API call as Personalization Strings in your email. No need to reference the target Data Extension again.

A5: You've got most of it, I think.

Here's an overview of the process to create a Triggered Send Definition and use the API to trigger it:

In your SFMC Account:

  1. Create a Data Extension based on a Triggered Send Template
  2. Create an email
  3. Create a Triggered Send Definition in Interactions and start it (make note of the Customer/External Key). Reference the Data Extension from #1 in the Subscriber Management section.
  4. Publish the Triggered Send Definition

In your API call:

  1. Do a CreateRequest on the TriggeredSend object
  2. Set the ClientID to your account's MID
  3. Set the TriggeredSendDefinition CustomerKey to the appropriate value for the Triggered Send Definition you created earlier
  4. Create a new Subscriber Object and set the SubscriberKey and EmailAddress
  5. Create a new Attributes object for each column in your target Data Extension -- specifying the name and value of each.

In the code of your email

  1. You can reference any attributes that you've sent along with your API call as Personalization Strings (e.g. %%FirstName%%).

Here's an example that's close to what I'm describing: Submitting a Triggered Send Definition Using the Asynchronous API

Some other important things:

  1. Required fields in your target Data Extension are required in your API call.
  2. The payload from your API call is written to the Data Extension before the email is sent. The data will be recorded even if there's some scripting exception in the email that prevents the email from being sent.
  3. Make sure you specify that subscribers are written to All Subscribers in your Triggered Send Definition (in addition to your target Data Extension).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .