Velocity Script in Webhook
Hi Community,
I need to create a dynamic token that i can pass via an webhook to an external system, in webhooks i have tried inserting tokens including: email script (velocity) as well as text (static), here static works fine when the call is made but not the velocity script.
for e.g.:
I created an Smart campaign where it triggers the webhook to call an external API with certain details like: Lead Name, Id, program name etc. For that i have created tokens and tried passing onto the webhook, it works but not exactly as expected.
Velocity Script:
#if( $lead.FirstName.equals("[Not Defined]") || $lead.FirstName.isEmpty() )
Hi there!
#else
Hi $lead.FirstName!
#end
It translated to:
{"codeBlock":"#if( $lead.FirstName.equals(\"[Not Defined]\") || $lead.FirstName.isEmpty() )\nHi there!\n#else\nHi $lead.FirstName!\n#end","scriptingObjects":{"standard":{"2":{"label":"Person","fields":{"28":{"label":"First Name"},"128":{"label":"Country"}}}}}}