An intelligent SMS Bot via Burner, Slack, and Api.ai
FAQBot is an SMS bot that augments Burner's Slack connection by enabling an Api.ai-powered agent to sit alongside the humans in your Slack channel and respond automatically and intelligently to incoming texts. FAQBot is designed as a customer service bot: it can answer questions about your product and even some general knowledge questions. It can also serve as reference code for anyone who wants to augment a human-powered, Burner-connected Slack channel and add an API.ai or other 3rd-party bot agent to that channel.
FAQBot is a fork of API.ai's Slack connection and was built by Voxable.
What's happening above:
- A user sends a text to our Burner line.
- The Burner Slack connection posts the SMS in our Slack channel.
- Our slackbot receives the SMS, parses out the sending phone number and message, and passes the message on to our Api.ai agent.
- Our Api.ai agent sends back a response, which our slackbot duly posts in the Slack channel, prepended with the phone number that sent the SMS, ensuring that our response gets sent back to the correct user.
- The Burner Slack connection sends an SMS back to the user.
You’ll need 2 keys:
- Client access token for Api.ai
- Slack bot API token
Before you begin, you'll need:
- A Burner account and at least 1 phone number. (Free + Trial)
- Access to a Slack team and at least 1 phone number. (Free)
- An Api.ai account and at least 1 phone number. (Free)
- A Heroku account and at least 1 phone number. (Free)
Don't worry if you don't have one or more of those accounts yet, you can always create them as you go through the setup flow below.
Create a new slackbot. Remember the name of the bot, as you'll need this later.
In Slack, invite @burnerbot and the @bot you created in step 4 to the channel you connected your Burner to in step 6.
Click the handy "Deploy to Heroku" button below to deploy the bot to Heroku.
Enter the credentials you gathered above in the "New App" screen and click the "Create App" button.
You're all set! Try texting a question to your Burner line, and you should get a response.
Ugh, I don't wanna
Don't feel like building this yourself? Think we at Voxable should just stop lollygagging and turn this into a product, already? Drop us a line and let us know!
Creating a human-assisted AI SMS support bot
Using the Api.ai General Knowledge domain to give FAQbot the ability to engage in small talk or tell you about the weather is all well and good, but Api.ai really shines when you use its interface to add new capabilities to your "agent." By using intents to represent questions you frequently recieve from customers, you can easily create an SMS support bot, powered by human-assisted AI!
We'll use intents within Api.ai to represent questions your customers might ask. An intent maps what is said by a user to what should happen in response - in this case, the agent should provide an answer to one of our Frequently Asked Questions.
Head back to your Api.ai workspace, and select the agent you created earlier from the list. Select the "Intents" option in the menu on the left-hand side, then click the blue "Create Intent" button at the top of the screen.
In the "User says" section, start by adding a question from your FAQ, and press return. You'll notice that the name of the intent at the top will become the first question you entered. On the next line, add another way that someone might phrase that same question, and press return again. Continue this process, adding several different phrasings of the same question, then press the blue "Save" button up at the top. You should have something like the following:
Skip down to the "Speech Response" section (the "Action" section isn't relevant to what we're building). This is where you'll specify the answer to a question:
You'll notice that, as in the "User says" section, you're able to add a number of responses. If you'd like, you can specify several different versions of the same answer to a question, and Api.ai will randomly select one of them as the response. This is a technique for making your bot seem more intelligent.
Testing your agent
Click on the grey box in the upper-right-hand corner that says "Try it now..." This is the test console, where you can enter a question you might receive from a customer to see how Api.ai handles it:
After you enter (or speak, if you're in Chrome) a question, you can see how your agent handles it. The "Speech Response" section shows us what will be texted back to your customer by the bot, and the "Intent" section shows us which question the agent understood was being asked.
Notice that, even though the test question was slightly different than any of the examples we provided in the "User Says" section, Api.ai's machine learning was intelligent enough to correctly understand what was being asked. The more examples you provide in the "User Says" section, the better the chance of the question being understood by your agent.
Filling in the gaps
You can repeat this process for as many questions as you would like: adding a new question, adding different versions of the question, adding answers, and testing the agent. Each question you add will save you time the next time that it's asked and then answered automatically. Leave the robot work to the robots.
Inevitably, though, you'll receive a question that FAQbot won't understand. In that case, you'll recieve an announcement in your Slack channel:
Humans to the rescue! At this point, your team can respond to the announcement and step in to save the day with the appropriate information for your customer. Just cut and paste the provided slash command, add the correct answer to the customer's query, and Burner will take care of zipping that fresh info back over to your customer as an SMS.
That's called human-assisted artificial intelligence. And you did it all without a $300 billion market cap!
This is a fork of Api.ai's Slack integration, with minimal modifications needed to make the magic happen with Burner. Brought to you by the good folks at Voxable, who always stand ready to help you give voice to your product, in collaboration with the stellar team at Burner.