Skip to main content
Skip table of contents

How to send SMS notifications from your chatbot

Last updated: 18 October 2023

With a little bit of ingenuity and a simple integration, your chatbot can automatically send SMS notifications (to yourself, your sales team, or even your users).

Let’s dive right in.

Step 1: Pick an SMS provider

To send your SMS notifications, you will need an SMS provider. We recommend Soprano Design, our parent company and CPaaS platform. While for the remainder of this tutorial we will use Soprano Design as our SMS provider, you should be fine using any provider you want; as long as they provide an API.

Make sure you have an active license, purchased a phone number in your location, and have credit.

Step 2: Grab your API details

Before we set up the integration in your chatbot platform, we need to grab some details from Soprano Design.

Log into your MEMS account and head over to Company SetupManage UsersAPI Keys.

Generate a new API key, which should come along with an API ID.

Step 3: Set up your SMS integration

Go to your chatbot platform, into Integrations and click Add new.

Give your integration a name, enter your Soprano Design base URL (e.g. https://uk.sopranodesign.com), and select REST.

No authorization needed, we will authenticate using the headers.

In the Headers section, enter the values you saved from Step 1:

  • X-MEMS-API-ID

  • X-MEMS-API-KEY

Hit Save.

The integration between your chatbot platform and Soprano Design is now set.

Next, we will create the endpoint.

Endpoint

The endpoint will contain the actual copy of the SMS you wish to send. This body can contain all sorts of information, including variables picked up from your conversation.

In your new integration, click Endpoints.

Give your request a name.

Make a POST request to /cgpapi/messages/sms.

For this tutorial, we will create a simple example. We will send an SMS notification to the chatbot user (after they’ve given us their number) to welcome them to our new marketing list. Here’s the body:

CODE
{
  	"messageType": "sms",
    "destination": "{{custom.get.mobile_phone}}",
    "text": "Hi {{ custom.get.first_name }}. Welcome to our list!",
    "source" : "44..."
}

Of course, make sure you enter a valid, Soprano Design-purchased phone number in source.

Hit Save.

Step 4: Create your conversation

As you can see above, we are going to need to collect two pieces of information from our chatbot users before we can send them the SMS:

  1. Their mobile phone

  2. Their first name

Let’s start by creating those variables

Variables

Go to SettingsVariables.

Click + Variable in the top right.

Create a first_name variable and hit Save. Repeat the same process to create a mobile_phone variable.

Conversation

Go to the Builder and create a new conversation.

Give it a name and a description, select Message as the starting step, as well as a trigger of your choice.

We’re going to create three steps:

  1. Ask for their name

  2. Ask for their phone number

  3. Confirm SMS sent

Edit the first step by clicking its three dots then Edit response. Edit the first message copy to something like:

Hit Save.

Add a new message step to the conversation, linked from the first, and repeat the same process. This time, ask for the user's phone number.

For the purpose of this tutorial, we will leave the transition to A message is sent but, of course, you can use any transition you need between these steps.

Add a final message step, perhaps with the following copy:

Assign variables

With the conversation and the variables created, we can now combine the two.

From the Block bank, click and drag a variable in transition between steps one and two. Since we’re asking for the user’s name in the first step, we will log that into first_name.

Repeat the process between steps two and three, this time logging mobile_phone.

Step 5: Trigger your integration

We’re basically there!

We collected the user’s first name and phone number, which is the information we use in our SMS notification. We just need to trigger the integration.

From the Block bank, click and drag an integration onto the last step of the conversation. Find your SMS integration and hit Save.

All done!

What next?

The simple example above is just that: simple.

There is a lot you can do with an SMS notification. For example:

  • Send an SMS notification to your sales team when a new lead comes through. All you’d have to do is enter your salesperson’s phone number under To in the endpoint.

  • Send an SMS notification to your users inviting them to come back to the chatbot (an adaptation of this tutorial, for example).

  • Offer gated content via SMS to your chatbot users. As your chatbot collects information on your users and turns them into lead, a step in the conversation sends them an SMS with a link to a special offer or a discount code.

And more!

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.