i would like to send a triggered send email initiated from the order management system to Marketing cloud. How would I be able to include in the payload specific data related to the order which would allow me to personalize the email with the order details.

Seems like in the examples API calls, it is always contact attributes that are passed in the API call.

  • what is the data type for personalisation; xml or json? Commented Nov 16, 2017 at 1:20
  • It is a JSON payload
    – Paul
    Commented Nov 16, 2017 at 2:56

1 Answer 1


There are several ways of going about this in the email. The payload in the API call is the easy part.

For example if you have the following JSON passed in an attribute named JSON in your API call:

    "sku": "123",
    "name": "Square",
    "url": "https://spmvs.com?sku=123"
}, {
    "sku": "456",
    "name": "Circle",
    "url": "https://spmvs.com/?sku=456"
}, {
    "sku": "789",
    "name": "Triangle",
    "url": "https://spmvs.com/?sku=789"

You can parse it with either GTL or SSJS in the email:

    body, a, input {font-family:sans-serif;}
<body style="font-family:sans-serif">
<h1>JSON Parse with GTL</h1>

var @json
set @json = AttributeValue("json")

if not empty(@json) then

{{.dataobject JsonVar type=variable source=@json maxrows=20}}
{{#each JsonVar}}

<br><a href="%%=RedirectTo(TreatAsContent('{{url}}'))=%%">{{sku}}</a> - <a href="%%=RedirectTo(TreatAsContent('{{url}}'))=%%">{{name}}</a>

  outputline(concat("<br>no JSON found"))

<h1>JSON Parse with SSJS</h1>
<script runat="server">
var json = Attribute.GetValue('json');
var jsonObj = Platform.Function.ParseJSON(json);
if (jsonObj.length > 0) {
  for (var i = 0; i < jsonObj.length; i++ ) {
      var item = jsonObj[i];
      <br><a href="%%=redirectto(@url)=%%">%%=v(@sku)=%%</a> - <a href="%%=redirectto(@url)=%%">%%=v(@name)=%%</a>
      <script runat="server">
} else {
  Write("no products found")

<br><br><br><a href="%%profile_center_url%%">Profile/Preference Center</a>
<br><a href="%%subscription_center_url%%">Subscription Center</a>
<br><a href="%%unsub_center_url%%">One-Click Unsubscribe</a>
<p>This email was sent by:
<br>%%Member_Addr%%, %%Member_City%%, %%Member_State%%  %%Member_PostalCode%%  %%Member_Country%%</p>
<custom name="opencounter" type="tracking">

There some more details here in this presentation: AMPScript Uncovered

You must log in to answer this question.

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