Sending SMS Messages With Twilio and a Campaign Trigger

This guide walks through how to set up a Campaign Trigger within your Lead Prosper campaign to send an SMS message using Twilio. Once configured you will be able to use the Twilio API to send SMS messages using a Campaign Trigger to notify whoever you may need that a lead has been processed.

Before configuring Lead Prosper, you’ll first need to complete a few setup steps in Twilio.


Twilio Setup

1) Create a Twilio Account

  1. Visit Twilio.com and create an account.
  2. Complete the signup and verification process.

The account setup process is straightforward and only takes a few minutes.

2) Purchase a Twilio Phone Number

To send SMS messages, you will need a Twilio phone number.

  1. Log into the Twilio Console
  2. In the left navigation menu go to Phone Numbers → Manage → Buy a Number

  1. Search for an available phone number
  2. Click Buy to purchase the number

This number will be used as the From phone number when sending SMS messages.

3) Validate Caller ID

If your Twilio account is on a free trial, you must verify recipient phone numbers before sending SMS messages.

Trial accounts can only send messages to verified phone numbers.

To test messaging, you will need to:

  1. Add a Caller ID number
  2. Complete the verification process

If you plan to send SMS messages to US phone numbers using a 10-digit number, Twilio requires A2P 10DLC registration.

You can learn more here:

Twilio SMS API Documentation

https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource

A2P 10DLC Registration Guide

https://help.twilio.com/articles/1260801864489-How-do-I-register-to-use-A2P-10DLC-messaging

5) Retrieve Your Twilio Account Credentials

Lead Prosper will need your Twilio API credentials.

  1. Go to your Twilio Console Dashboard
  2. Scroll down to Account Info
  3. Copy the following values:
  • Account SID
  • Auth Token

You will use these credentials when configuring Lead Prosper.


Lead Prosper Set Up

Twilio can be integrated into Lead Prosper in two different ways:

  1. Direct Post Buyer – Sends SMS messages when a lead is posted to a buyer
  2. Campaign Trigger – Sends SMS messages based on campaign events (for example when a lead is accepted)

Both configurations use the same Twilio API endpoint.

In this guide we'll be going through the set up for a Campaign Trigger. Campaign Triggers allow SMS messages to be sent based on lead events, such as when a lead is accepted.

1) Create a Campaign Trigger

  1. Navigate to Campaign Triggers
  2. Click Create New Trigger

Configure the following settings:

Setting Value
Title Twilio SMS (or any name you prefer)
Type Real Time

2) Configure Trigger Conditions

Set your trigger conditions to set when the Campaign Trigger will fire.

Example: Lead Status = Accepted

This means the SMS message will be sent whenever a lead is accepted / sold.

3) Create the Trigger Action

Under Actions, select New Action

Set the action name to something like - in this example I am using Twilio SMS

Under Action using the following configurations

Setting Value
Post Type POST
Posting URL https://api.twilio.com/2010-04-01/Accounts/{{ACCOUNT_SID}}/Messages.json

Replace {{ACCOUNT_SID}}  with your Twilio Account SID.

4) Add Custom Header

Add the following custom header:

Key Value
Authorization Basic {{TOKEN}}

To get the value for {{TOKEN}} you need to take your Twilio Account_SID and the Auth_Token values you got in the first part of the tutorial and use them as Usename and Password to get your Basic token value. Use a website like https://www.debugbear.com/basic-auth-header-generator and set it up with: Username = Account_SID

Pasword = Auth_Token

From there you will be presented with the full header that will look something like "Authorization: Basic QjkzZjc1YTBzZDlmMDlzYWRmOGQ4ODBlMDBkMTljYTQ3OmRjZG9pYXM5ZjBhdzNvaWFpZG9pMzQzMmU3NzdiYWYwMGJk" - copy the value after "Basic" and swap that in place of {{TOKEN}}

5) Configure the Buyer Payload

The Twilio messaging API requires three parameters:

  • To
  • From
  • Body
  1. To (Recipient Phone Number)

This is the phone number that will receive the SMS message.

The number must be formatted using E.164 format:

+12125551234

This format includes Country code + 10 digit phone number, no spaces or special characters.

Pro Tip  - Use a Computed Field in Lead Prosper to automatically convert incoming phone numbers into the correct format.

  1. From (Twilio Sending Number)

This is the Twilio phone number that will send the message.

Example: +19195551234

This value can typically be hardcoded in the payload since it will always be the same Twilio number.

  1. Body (SMS Message Content)

The Body field contains the message that will be sent.

Example:

Body=Name: {{first_name}} {{last_name}}, Phone: {{phone}}, Email: {{email}}

You can include Campaign fields, Computed fields, System fields, and hardcoded values.

SMS Formatting Tips

  1. Add Line Breaks

To add a new line in the SMS message, use %0a

Example: Body=Name: {{first_name}} {{last_name}}%0aPhone: {{phone}}%0aEmail: {{email}}

  1. Avoid Ampersands (&)

Ampersands can break the payload formatting.

Instead of: Name & Phone

User: Name and Phone

5) Test and Enable

  1. Click Add +
  2. Run a test
  3. Confirm the message is successfully sent
  4. Enable the Campaign Trigger

Once enabled, SMS messages will automatically send when the trigger conditions are met.


Once your Twilio account is set up and you’ve purchased a phone number, the rest of the process is straightforward. Simply retrieve your Account SID and Auth Token from the Twilio dashboard and use them to configure the Twilio API connection in Lead Prosper. From there, you can begin sending SMS messages either through a Direct Post Buyer or a Campaign Trigger, depending on how you want the messages to be initiated. Both methods rely on the same Twilio API endpoint and payload structure, making it easy to implement SMS messaging across different workflows in your campaigns.

Still need help? Contact Us Contact Us