How to Create an SMS AI Chatbot with ChatGPT

AI Chatbots for SMS and text messaging are here!

Creating an SMS AI Chatbot for customer service using ChatGPT and Twilio is easy and requires a few simple steps.  After running through this guide,  your company can automatically respond to customer questions using SMS and you can also escalate your SMS conversations to your customer service agents in Microsoft Teams, Slack, or your web dashboard.  We will show you how to set up your SMS chatbot powered by ChatGPT, and how you can train your AI chatbot on your business website content.

Here are some things you can do with SMS + Twilio + Social Intents:

  • Answer inbound SMS messages right from your Social Intents account on the web or any integration like Microsoft Teams
  • Create an AI enabled SMS chatbot to automatically respond to your customer SMS questions
  • Train ChatGPT on your website content, articles, files, spreadsheets, PDFs, and knowledge base
  • Set up initial System messages for the ChatGPT API
  • Setup Human Escalation Trigger phrases that will invite human agents to your visitor conversations
  • Register leads to your service with a chatbot
  • Direct your website visitors to website information with a chatbot

Here's a step by step guide to creating your first SMS chatbot with ChatGPT and Social Intents.

Prerequisites

High Level Steps

  1. Create a Twilio Account
  2. Get a Twilio Phone number that is SMS enabled
  3. Setup your Twilio Messaging service
  4. Create a Social Intents free trial and enable SMS settings
  5. Configure Messaging Endpoints in Twilio to point to Social Intents
  6. Enable ChatGPT in your SMS Chatbot
  7. Test your SMS by sending a message to the phone number you've configured.

Step 1: Create a Twilio Account or Sign in if You Have One

Sign up or log In:

  • If you don’t already have a Twilio account, go to Twilio’s website and sign up for a free account.
  • If you already have an account, simply log in.

Verify Your Phone Number:

  • During the signup process, Twilio will require you to verify a phone number. This number will be used for testing and verification purposes.

Step 2: Get a Twilio Phone Number

Navigate to the Account Dashboard:

  • Once logged in, go to the Twilio Account Dashboard. 

Select a New Twilio Phone Number:

  • Go to the Phone Numbers section under the Develop tab.
  • Click on Manage, then Buy a Number to purchase a Twilio phone number that you can use to send and receive SMS messages. 
  • Ensure that the number you choose has SMS capabilities. 

Step 3: Set Up Your Twilio Messaging Service

Create a Messaging Service:

  • In the Twilio Dashboard, navigate to Messaging > Services. If you don’t see Messaging in the left sidebar, select Explore products and then choose Messaging.
  • Click on Create Messaging Service and give your service a name.

Add Your Twilio Number to the Service:

  • Once the Messaging Service is created, select the Sender Pool link.
  • Select the phone number you purchased above as the Sender.

Set Up Your A2P 10DLC Compliance Details:

  • Register Campaign Details for your Phone number and Messaging service to be able to send or receive SMS messages on your number.
  • Click Register a Campaign and enter details of your Brand.
  • Choose the Messaging Service you created in the step above.
  • Enter your Campaign Description (e.g., how you will be using the SMS phone number).
  • Enter example messages (e.g., order status details).
  • Select your Opt-in and Opt-out words that senders will use to start or stop messages.

Step 4: Sign Up for a Social Intents Account and Configure SMS Integration

Sign Up for a Social Intents Account:

  • Go to Social Intents and sign up for an account if you don’t have one.

Set Up SMS Integration:

  • Navigate to the Integrations page and click on the SMS Integration button.
  • In the Client Settings page, configure the following:
    • Twilio SMS Number: Enter the Twilio phone number you purchased.
    • Route Inbound to Chat App: Choose the chat app you want to route inbound messages to.
    • Twilio Account ID: Enter your Twilio Account ID. You can find this here.
    • Twilio Auth Token: Enter your Twilio Auth Token.
    • Twilio Webhook URL: This URL will be provided on the Client Settings page after you’ve configured the above settings. Copy this URL for the next step.

Step 5: Configure Your Twilio Messaging API Endpoints

Select Your Active Number:

  • Head to Phone Numbers > Manage > Active Numbers and select your phone number.

Configure the Messaging Service:

  • Scroll down to the Messaging Configuration section and select the Messaging Service you created earlier.
  • Set the Configure with option to "Webhook, TwiML Bin, Function, Studio Flow, Proxy Service."
  • Set Webhook to the A message comes in section.
  • Paste the Twilio Webhook URL you copied from the Social Intents Client Settings page into the Webhook URL field.
  • Save your changes.

Step 6: Enable ChatGPT for Your SMS Bot

Create Your OpenAI Account:

  • Sign up for an OpenAI account if you haven’t already at https://platform.openai.com
  • Once logged in, click on your default project or create a new one, then API Keys.
  • Create a new API Key for integration with Social Intents. 

Add Your OpenAI API Key to Social Intents:

  • In Social Intents, go to the Live Chat Settings by clicking on My Apps, then Edit Settings of your chat widget.
  • Click on the Chatbot Settings tab.
  • Name your bot, choose an avatar, and select Chatbot Type of 'ChatGPT with OpenAI'.
  • Copy your OpenAI API Key into the field called ChatGPT API Key.

Customize Your Chatbot:

  • Customize your ChatGPT Welcome text, Quick Reply buttons, and Human Escalation trigger phrases.
  • Configure the ChatGPT Instruction Phrases to point to your website URL to guide the chatbot’s responses.

Train Your AI Chatbot on Your Content:

  • Click on the Train your chatbot button in the chatbot settings.
  • Enter the base domain or individual URLs you want to use to train the bot.
  • Click Train All to train your ChatGPT chatbot on your own content.

Step 7: Test Your Inbound SMS AI Chatbot

Send a Test SMS:

  • Now that your configuration is complete, you can start testing out your new SMS Chatbot.  Simply send a text message to the number you set up and your AI chatbot should respond with the data you trained it on.

Check the Response:

  • Ensure that your setup handles the incoming SMS as expected and sends back a response.

Conclusion

Congratulations! You’ve successfully set up an SMS chatbot using Twilio, Social Intents, and ChatGPT. Your chatbot is now ready to enhance your company's customer service by providing another channel for customer support.

For more information, you can start your 14-day free trial at Social Intents and explore additional features.