Sending an SMS using Twilio

John_M
Marketo Employee
Marketo Employee

Webhooks are a great way for Marketo to interact with external systems and interfaces.  Common use cases include leveraging 3rd party interfaces for de duplication, to enrich lead data, and to send SMS messages. Here's an example of doing the latter leveraging Twilio, a Launchpoint partner of Marketo. The documentation for sending SMS messages for Twilio is also available.

Side note: Launchpoint is a thriving ecosystem of corporate partners that are actively developing solutions that complement the Marketo Platform. It's worth a look!

First...sign up for a Twilio account, taking note of your authentication token, you'll need that for sending your SMS.

Next up, create your webhook. Head over to Admin --> Integration --> Webhooks and click "new"

skitch-1.png

Webhook Name: Twilio Webhook

Description: Send an SMS

URL: https://%AccountSID%:%AuthToken%@api.twilio.com/2010-04-01/Accounts/%%AuthToken%@api.twilio.com/2010-04-01/Accounts/%AccountSID%/Messages.json (note you'll have to replace "Account SID" and "AuthToken" with the values from your Twilio Account

Request Type: POST

Template: From=%Your Send Number%&To={{lead.Mobile Phone Number}}&Body={{lead.Twilio Message:default=Test Message}}

Request Token Encoding: jSON

Response Type: None

Notes

     You'll need to put in your own Account SID and Auth Token

     You'll need to procure a Twilio Phone number to send from

     I also added a response mapping, as you can see of the "error_code" into the "twilioError" (API name) field. More on this later.

Once you have your Webhook set up, you have access and use it in your campaigns! In my example, I've set up a simple form on a Marketo Landing Page (both responsive and standard) that accepts First Name, Last Name, Email, Mobile Phone Number, and asks for a Message (limited to 255 characters). The lead is submitted to Marketo, the following data is updated or inserted

First Name

Last Name

Email Address

Mobile Number

SMS Message - a new string custom field on the Marketo Lead called "Twilio Message"

Error - a new string custom field on the Marketo Lead called Twilio Error

The Form and the Marketo Landing Page

I created a simple Form soliciting the above information (except Twilio Error, obviously), all of which are required, and put that form on a landing page. It looks like this:

skitch-2.png

The Campaign

Then we can create a simple campaign that is triggered off of the form being submitted, and then simply calls the webhook.

The Campaign Smart List

skitch-3.png

The Campaign Flow:

skitch-4.png

Once you've got all of that in place, submit the form, and youll see that SMS come through.

skitch-5.png

skitch-6.png

You can verify the SMS was sent in two places

1. The results tab of the campaign

skitch-2.png

2. The Lead Details Activity Tab

skitch-1.png

Bonus round

Sometimes the SMS may fail, and you may want to monitor for that. To do that, You can create a simple campaign trigging off the value changed of the "Twilio Error" field where the new value is not null. For the flow step, you can send an alert anywhere you like.. to an admin a distribution list.. wherever.

Cool, right?

11969
14
14 Comments
JeffHensiek
Level 4

This is really neat and I'm looking forward to testing this out.

 

Does anyone have any advice on how to set up a SMS as part of an email drip series?  For example:

  • Email 1 (day 1)
  • Email 2 (Day 2)
  • SMS 1 (Day 3)
  • Email 3 (Day 4)
  • SMS 2 (Day 5)

 

Also, any suggestions on creating SMS notifications that include lead/contact info?  For example, a form get's filled out and we send an SMS to their sales rep that includes the leads contact details for a quick "click-to-call" by the sales rep?

 

Any thoughts?

 

Thanks to all.

Tyron_Pretorius
Level 9 - Champion

@JeffHensiek 

 

"Also, any suggestions on creating SMS notifications that include lead/contact info" you can use lead and company tokens in the webhook body to populate the SMS information. You can refer to this blog post to see how to do this: https://theworkflowpro.com/marketo-webhook-guide-with-examples/

 

Regarding the drip series with SMS, there are a few different ways to do this:

 

 

jnkrochman
Level 2

@JeffHensiek @Tyron_Pretorius 

Following up on what Tyron shared. Here is an example we use for a similar use case:


{ 'text': '{{lead.Full Name:default=edit me}}\n{{lead.Record ID URL:default=edit me}}\nPhone: {{lead.Mobile Phone Number:default=edit me}}\nEmail: {{lead.Email Address:default=edit me}}' }

 

For your purpose, on trigger campaign of new lead creation call webhook. In the webhook it would look something like this:
From=[Insert from number or messaging SID]To=[Insert To Number]&Body=Name: {{lead.Full Name:default=edit me}}\nRecord ID: {{lead.Record ID URL:default=edit me}}\nPhone: {{lead.Mobile Phone Number:default=edit me}}\nEmail: {{lead.Email Address:default=edit me}}

If in the program you wanted to make it more variable, I believe you could also put that into a token and simply call the token you want, but I have not tested this.
Webhook:

From=[Insert from number or messaging SID]To=[To Number]&Body={{my.SMS Lead Info}}

Token:

{{my.SMS Lead Info}} = "Name: {{lead.Full Name:default=edit me}}\nRecord ID: {{lead.Record ID URL:default=edit me}}\nPhone: {{lead.Mobile Phone Number:default=edit me}}\nEmail: {{lead.Email Address:default=edit me}}"

JeffHensiek
Level 4

Thank you, @jnkrochman and @Tyron_Pretorius for your feedback on how to configure these items.  I appreciate it.