Currently, Webhook payloads do not allow Velocity Script tokens. Why not?
Using a Velocity Script token to generate the JSON payload for a Webhook would be very helpful. For instance, the JSON structure of my Webhook could vary conditionally based on Lead and/or Program tokens. Currently, if I want to perform different actions in an external API, I would have to create numerous Webhooks. I don't want to have a different Webhook for each variation of my API calls. I would like to use a single Webhook, but vary the payload using the conditional logic of a Velocity Script.
Desired
Webhook - Mail Item
{
"leadId": {{lead.Id}},
"sku": {{my.SKU}},
"qty": 1,
"address": {
"name": {{lead.Full Name}},
"street": {{lead.Address}},
"city": {{lead.City}},
"state": {{lead.State}},
"postcode": {{lead.Postal Code}}
},
"data": {{my.Custom Script}}
}
Velocity Script Token - {{my.Custom Script}}
{
"postcard_message": "Dear ${lead.FirstName},\\nYour subscription is about to expire on ${lead.subscriptionEndDate}.\\nRenew today!"
}
Velocity Script Token - {{my.Custom Script}} in another Program
{
"brochure_image": "${my.brochureImage}",
"brochure_copy": "${my.brochureCopy}"
}
Current
Webhook 1 - Mail Postcard
{
"leadId": {{lead.Id}},
"sku": {{my.SKU}},
"qty": 1,
"address": {
"name": {{lead.Full Name}},
"street": {{lead.Address}},
"city": {{lead.City}},
"state": {{lead.State}},
"postcode": {{lead.Postal Code}}
},
"data": {
"postcard_message": {{my.Custom Postcard Message}}
}
}
Webhook 2 - Mail Brochure
{
"leadId": {{lead.Id}},
"sku": {{my.SKU}},
"qty": 1,
"address": {
"name": {{lead.Full Name}},
"street": {{lead.Address}},
"city": {{lead.City}},
"state": {{lead.State}},
"postcode": {{lead.Postal Code}}
},
"data": {
"brochure_image_1": {{my.Custom Brochure Image}},
"brochure_copy": {my.Custom Brochure Copy}}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.