@SanfordWhiteman After your below reply (Send VTL, including #set() , as the {{my.token}} value.) , We got the idea that we can pass VTL (velocity template language) from API as token content along with data. By referring to your blog post , we were able to pass json data (see texttemplate variable below) from API itself with VTL included to parse and layout that json data. Here is how final request looks like
curl -X POST \
https://<munchkinid>.mktorest.com/rest/v1/campaigns/1025/trigger.json \
-H 'Accept: */*' \
-H 'Authorization: Bearer <token>' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: <munchkin-id>.mktorest.com' \
-H 'Postman-Token: <postman-token>' \
-H 'User-Agent: PostmanRuntime/7.15.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'cache-control: no-cache' \
-H 'content-length: 1591' \
-d '{
"input": {
"leads": [
{
"id": 2
}
],
"tokens": [
{
"name": "{{my.texttemplate}}",
"value": "<table border=1><tr><th>Email Id</th><th>Full Name</th><th>Date Referred</th><th>Referral Program</th></tr> #set($jsonString = '\''[{\"Email\" : \"joe@example.com\",\"FullName\" : \"Joe Exton\",\"DateReferred\" : \"2016-08-01\",\"ReferralProgram\" : \"Season Pass Holders\"},{\"Email\" : \"jill@example2.com\",\"FullName\" : \"Jill Towson\",\"DateReferred\" : \"2016-08-03\",\"ReferralProgram\" : \"Gold Donors\"}]'\'') #set( $jsonData = '\''#set( $jsonData = '\''+$jsonString+'\'')'\'') #evaluate($jsonData) #foreach($jdata in $jsonData)<tr><td >${jdata.Email}</td><td >${jdata.FullName}</td><td >${jdata.DateReferred}</td><td >${jdata.ReferralProgram}</td></tr> #end </table>"
},
{
"name": "{{my.order-number}}",
"value": "3023532055"
},
{
"name": "{{my.shipment-on-way}}",
"value": "Your order has shipped and is on it'\''s way!"
},
{
"name": "{{my.order-status}}",
"value": "Partially Shipped"
},
{
"name": "{{my.track-shipment}}",
"value": "9012412122"
},
{
"name": "{{my.shipping-method}}",
"value": "Standard (2-Day Guaranteed)"
},
{
"name": "{{my.packing-slip}}",
"value": "7569737098"
},
{
"name": "{{my.ship-to-account-number}}",
"value": "98746892"
},
{
"name": "{{my.ship-to-account-name}}",
"value": "chicago childcare hospital"
},
{
"name": "{{my.delivery-address}}",
"value": "121 s tonne dr, arlington heights, IL from postman"
}
]
}
}'
... View more