I am having trouble figuring out how to do the following;

Lets say I have a customer that comes to our site, and buys two of our products. They provide their email, first name, and last name.

And lets say in my exact target account, I have created a template in the following location;

Content > My Templates > PetShop > new_order_template

After they sign up, I want to update my subscribers list

After that, I want to select the template new_order_template, and populate it with the appropriate data.

Lets say this is what I have for data

$email = '[email protected]';
$first = 'hello';
$last = 'world';
$product = array(

Could some please help me figure how I would do this in PHP using the Web API.

I would greatly appreciate the help.

Thank you!

1 Answer 1


Within ExactTarget Email, a template object very basic skeleton that is used to create an email object. An email can be created off a template or it can be created without a template by providing all the HTML. The Email is the final object that is used for sending which would contain all of the content and personalization values.

For example, the body of the email may contain a reference to a profile attribute which is used to hold first name using %%first%%, then when the email is sent to a subscriber it will pull the value of the "first" profile attribute and place it there when it builds the email.

If using the TriggeredSend functionality for adhoc emails, then a Triggered Send definition would need to be created which references the Email object so it know what content to send, then the API request would reference this definition using the CustomerKey(External Key) value along with send specific information.

One thing to note based on your sample, it contains an array which is not a supported data type for subscriber attributes. This data could be stored in ExactTarget in a Data Extension which could be leveraged at send time using AMPscript or the values could be stored as XML which would need to be parsed using AMPScript in order to display them in an email.

Get setup for using PHP with the SOAP API: http://help.exacttarget.com/en/technical_library/web_service_guide/getting_started_developers_and_the_exacttarget_api/connecting_to_the_api_using_php/

Example code for triggering an email: http://help.exacttarget.com/en/technical_library/web_service_guide/technical_articles/send_triggeredsend_email/

  • Hi @Mac, thanks for the help. Would CustomerKey in my case be the name of the template? For example, if I have an email template called "new_order_template" I would initialize it as such; $tsd->CustomerKey = "new_order_template";
    – Question
    Mar 19, 2014 at 14:37
  • The CustomerKey value that you need to pass in the API is called External Key in the UI. It can be found on the Triggered Send Definition by going to the Interactions tab in ExactTarget then Triggered Send, then selecting a definition.
    – Mac
    Mar 19, 2014 at 14:42
  • forgive me, but I still don't understand how I identify which template I want the triggering email to use. As I mentioned, I lets say I have an email located at Content > My Templates > PetShop > new_order_template What is the line of code that would target that template?
    – Question
    Mar 19, 2014 at 15:04
  • You can't target a template directly. You create an email from that Template, by going to Content > My Emails. Then when creating a Triggered Send definition in Interactions > Triggered Sends, there is an option to select which email.
    – Mac
    Mar 19, 2014 at 15:12
  • Thank you so much Mac. This is the answer I was looking for. I started this quest with the preconception that the API would have the means to allow me to do as such.
    – Question
    Mar 19, 2014 at 15:27

You must log in to answer this question.

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