I would like to pass a variable to a triggered send email, what is the ampscript function I'd need to use to capture the variable (not a profile attribute) in my email body.


Use a Triggered Send Data Extension Template to create your Triggered Send Data Extension. Add the field to your Data Extension, "MyVar". Personalise as though it's an attribute - %%MyVar%%.

If you're firing the triggered send from SOAP or REST, you would pass the variable so...


<CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
 <Objects xsi:type="ns2:TriggeredSend" xmlns:ns2="http://exacttarget.com/wsdl/partnerAPI">
    <PartnerKey xsi:nil="true"/>
    <ObjectID xsi:nil="true"/>
       <PartnerKey xsi:nil="true"/>
       <ObjectID xsi:nil="true"/>
       <PartnerKey xsi:nil="true"/>
       <ObjectID xsi:nil="true"/>
          <Value>Some value I want to personalise my email with</Value>
          <Value>Some other value I need in my email</Value>


Host: https://www.exacttargetapis.com
POST /messaging/v1/messageDefinitionSends/key:MyTriggeredSendCustomerKey/send
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

    "From": {
        "Address": "updates@mycompany.com",
        "Name": "MyCompany Inc"
    "To": {
        "Address": "johndoe@hotmail.com",
        "SubscriberKey": "C1234566",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "MyVar": "Some value I want to personalise my email with",
                "MyVar2": "Some other value I need in my email",
    "OPTIONS": {
        "RequestType": "SYNC"
| improve this answer | |
  • I tried to use the personalization strings href="%%MyVar%%" but seeing the following error "The subscriber preview failed to generate. Review the details, correct all issues, and try again. Personalization error: %%MyVar%% To fix the problem, please try the following: - Make sure that there is not a space or typo within the personalization string in your email. For example, check and correct any spaces between percent signs (%%) - Correct the HTML Body of your email." Any idea on how to use the variable? – cdr Jun 4 '17 at 8:04
  • Which Data Extension are you doing Send Preview against and does it have a MyVar field? – Macca Jun 4 '17 at 8:07
  • hey Sorry, I forgot to change the path, now am able to see the preview. And also I was able to target the triggeredsend DE and start the trigger with no validation errors. Thank you so much, Andrew! – cdr Jun 4 '17 at 8:11

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.