SOLVED

Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Go to solution
Anonymous
Not applicable

Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Has anyone had success pulling lead data like "lead.First Name" through to their SMS messages with Twilio? I know you can't have a token in a token but can this be accomplished with Velocity script?

Our initial attempts with velocity scripts are returning the code in the sms messages.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Velocity doesn't execute in the webhook context.

You can include {{lead.}} tokens in webhook URLs/payloads.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Velocity doesn't execute in the webhook context.

You can include {{lead.}} tokens in webhook URLs/payloads.

Jay_Jiang
Level 10

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

I think what Tim is currently doing is using a {{my.}} token to populate the SMS body in the webhook but unable to personalise the message.

This is a more advanced solution but what you could do is essentially create your own webhook endpoint that uses your own "token" rules to update the SMS message before sending it on to Twilio. Your marketo webhook call would include all the {{lead.}} tokens you'd need to use + the {{my.}} token message where you'd code your own tokens

e.g.

endpoint: https://my.endpoint.com/twilio.php

payload: fn={{lead.First Name}}&ln={{lead.Last Name}}&bd={{lead.Birthdate}}&msg={{my.message}}

{{my.message}}: "Hi /fn/ /ln/! Today, /bd/, is your birthday! So we at XYZ wish you a happy birthday!"

You'd set up your rules to replace / / with {{lead.}} token values which updates the sms body before sending it on to Twilio


N.B. We just create a new webhook with a new message

Anonymous
Not applicable

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Hi Jay & Sanford,

Thanks for your responses! All of my content to date for messages was custom, so I was relying my.token when setting my outbound message when i could go directly to lead.first name. Just needed to step away for a couple minutes to get the resolution.

That being said, I am running into the infamous date issue where we need to output the date in a specific format for SMS. My thought is to create a new text  field of the date field. I am just wondering how I can handle this within a smart campaign to fill the new field with the properly formatted date. Any thoughts?

SanfordWhiteman
Level 10 - Community Moderator

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Thanks for your responses! All of my content to date for messages was custom, so I was relying my.token when setting my outbound message when i could go directly to lead.first name. Just needed to step away for a couple minutes to get the resolution.

OK, so far so good, but...

I am just wondering how I can handle this within a smart campaign to fill the new field with the properly formatted date. Any thoughts?

... this is going to take an additional webhook to populate the other text field in your preferred format.

Anonymous
Not applicable

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Thanks

Tyron_Pretorius
Level 8 - Champion

Re: Lead Tokens Displaying Correctly in SMS Messages(Twilio)

Sharing this screenshot here to supplement what Sanford already confirmed about using lead tokens in the webhook body. You can also use the {{campaign.description}} token in the SMS webhook so that you can change the SMS message from smart campaign to smart campaign and still use a single webhook (as detailed in this blog post: https://theworkflowpro.com/marketo-sms-integration/)

 

marketo_sms_integration_webhook_campaign_description.png

Tyron Pretorius
Tags (3)