EXPERT INSIGHTS

Sep-17-2020

Engage with customers using Khoros and SMS text messaging

Khoros Staff

Editor's note: This blog post was originally written on the Flow.ai website. Flow.ai was acquired by Khoros in 2021 to advance Khoros' conversational AI and machine learning (ML) capabilities and data science expertise. This blog post has been adapted to be on the Khoros blog.



Using SMS text messages is easy to start a conversation with customers. Some use cases include: send a notification, like a delivery update, deflect a phone call to text messaging, and bulk sending a message to customers.

Here's what you need:

To get started you’ll need the following:

  • A Khoros instance that is connected to a phone number
  • A registered bot user within the Khoros instance
  • A Flow.ai account and organization

Getting started

To start sending outbound messages you’ll need to connect Flow.ai with Khoros, configure the Flow.ai REST API and add a flow to trigger.

1. Connecting Flow.ai with Khoros

  • Login into your Flow.ai project
  • Go to the integrations overview
  • Add a new Khoros integration within the customer service section
  • Choose a bot name
  • Provide the bot username and password (please contact Khoros support to create a bot user for your Khoros instance)
  • Add your company key (check the Khoros developer settings to find the name)
  • Choose the correct region (ask Khoros support if you do not know the region of your instance)
  • Choose SMS as the channel
  • Add the phone number connected to Khoros as the external ID
  • Add the same phone number in the phone number field
  • Add support@flow.ai as the contact email address

2. Configure the Flow.ai REST API

Using the REST API you can make a direct broadcast call to Flow.ai using a customer phone number (MSISN) that would trigger a specific flow.

That way you can send text messages to customers through the Khoros SMS integration.

  • Go to the organisation settings screen (top right)
  • Choose “API Keys”. If you do not see this item, you do not have sufficient permissions for the organisation. Please contact the owner of the Flow.ai organisation.
  • Create a new API key (choose the default settings)
  • Go back to the project and open up the integrations overview
  • Add a new REST API integration
  • Choose the API key from the dropdown and press save
  • Copy the REST API token and store it for later usage

3. Creating a Flow to trigger

We have everything ready to trigger a flow that will send an outbound message to a user. The only thing missing is a flow to trigger. Simply add a new flow and make it start with an event. For example name the event: Send SMS.

Below the event, drag and drop a text reply. Add some text like: This is a test message

Save the flow. Now we can test the entire setup!

Testing

You can test the broadcast using a CURL command to make a call to the REST API.

The following is an example of a CURL command:

curl --location --request POST 'https://api.flow.ai/rest/v1/broadcast/instant' \
--header 'Content-Type: application/json' \
--header 'Authorization: sk_ab12abcd9876543210abcdefgh012345' \
--data-raw '{
    "audience": [{
        "name": "John Doe",
        "phoneNumber": "+1234567890"
    }],
    "channel": {
        "channelName": "khoros",
        "externalId": "+0987654321"
    },
    "payload": {
        "type": "event",
        "eventName": "Send SMS"
    }
}
'

Replace the information:

NameDescription
API_TOKENRest API token copied in step 2
CUSTOMER_NAMEName of the customer (or anonymous)
CUSTOMER_MSISDNValid phone number in international format
KHOROS_EXTERNAL_IDKhoros external ID (phone number)
EVENT_NAMEEvent name of the flow to trigger
curl --location --request POST 'https://api.flow.ai/rest/v1/broadcast/instant' \
--header 'Content-Type: application/json' \
--header 'Authorization: API_TOKEN' \
--data-raw '{
    "audience": [{
        "name": "CUSTOMER_NAME",
        "phoneNumber": "CUSTOMER_MSISDN"
    }],
    "channel": {
        "channelName": "khoros",
        "externalId": "KHOROS_EXTERNAL_ID"
    },
    "payload": {
        "type": "event",
        "eventName": "EVENT_NAME"
    }
}
'


    Would you like to learn more about Khoros?