4

I need to send out triggerd Order Confirmations via ExactTarget.

So far i'm able to send a triggered email via the rest API with a single order line where i have the order details created in a Data Extension and fill these via the JSON I send.

https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/key:xxxxx/send?access_token=xxxxx

{
    "To": {
        "Address": "xxxx@xxxx.xx",
        "SubscriberKey": "xxxx@xxxx.xx",
        "ContactAttributes": {
           "SubscriberAttributes": {               
           "First Name": "Danny", 
           "ArticleID": "12345",
           "ArticleDescription": "Object1",
           "ArticleAmount": "2",
           "ArticleSize": "XL",
           "ArticlePrice": "4.00",
           "OrderSubTotal": "6.00",
           "OrderVat": "2.00",
           "OrderTotal": "8.00"
           }
         } 
    }
}

Using %%ArticleID%% etc. I show these values in the mail body.

But what I want to send is something like:

{
 "To": {
    "Address": "xxxx@xxxx.xx",
    "SubscriberKey": "xxxx@xxxx.xx",
    "ContactAttributes": {
     "SubscriberAttributes": {
          "First Name": "Danny"
        }
    }, 
    "OrderAttributes" : {
        "OrderLines": {
         "OrderLine" : {
                  "ArticleID": "12345",
                  "ArticleDescription": "Object1",
                  "ArticleAmount": "2.00",
                  "ArticleSize": "x",
                  "ArticlePrice": "4.00"
                },
               "OrderLine" : {
                  "ArticleID": "5678",
                  "ArticleDescription": "Object2",
                  "ArticleAmount": "1.00",
                  "ArticleSize": "",
                  "ArticlePrice": "1.00"
                 }
        },     
        "OrderSubTotal": "4.00",
        "OrderVat": "1.00",
        "OrderTotal": "5.00"
    } 
 }
}

and use this info to create a table with all orderlines and price summary to display in the mailbody.

Any suggestions on how to accomplish this via the REST API? Is using DataExtensions the right approach or should I pre-build a htmlcode block and include that as a single replacement string in the mail?

0

I would place AMPscript in your triggered email to do all the "heavy lifting." Use the lookup functions to get the data into your table, along with the v() operator. You won't have to pass nearly as much in through your REST call that way.

  • Thank you, for now we placed all order details in XML and read them into a data extension. From there we use AMPscript and v() as you sugested. – Danler Sep 5 '14 at 11:37

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.