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?

11861
14
14 Comments