Build a hybrid human + AI messaging experience on Slack

Bring humans in the loop in minutes using Janis + Botkit

Josh Barkin
Slack Platform Blog
6 min readApr 4, 2017

--

We started with a simple bot monitoring service that sent alerts to a Slack channel anytime our bot was unable to communicate with users. We could also drill down and get some basic reporting with charts and graphs. Our goal was to get real-time insights, identify bottlenecks, and make adjustments to our conversational experience.

As Slack’s platform evolved, we realized that we could act on insights without leaving Slack. When our bot was unable to communicate, we could take over live and engage users directly, then resume the bot when we were done. Enabling human + AI messaging experiences became Janis’s core value proposition.

In this article I will share some sample use cases for a hybrid human + AI solution.

Use cases for a human + AI hybrid messaging solution

Get feedback on your UX

Build a bot and include a feedback button. You can set up a Janis alert trigger using the keyword “Feedback”. When your users enter their feedback, Janis will capture that and send it to you on Slack. You can even pause your bot and get 1 on 1 with your user for additional feedback, or thank them personally for providing feedback. Janis will automatically resume your bot when you’re done.
(Implementation: Easy)

Manage employee relationships

Build a bot that answers your employees most frequently asked questions. Loop in HR when your employees have more personalized questions, or issues they want to discuss. Maintain a full transcript of the conversation.
(Implementation: Easy)

Deliver customer service

Build a support bot that answers frequently asked questions. Include a button to request live support and/or enable users to enter words like “human” or “agent” to get live support. Janis will notify you on Slack and open a channel for you to get 1 on 1 with your customer. If you need to loop in a specialist, simply mention them in your channel with your customer and team-up to solve complex customer problems.
(Implementation: Medium)

Build a consulting service

Build a bot that delivers useful stories related to your industry and your specific area of expertise. Provide this as a free value-added service and include an automated message that you’re available for questions that relate to each story shared by your bot. Using Janis, take over and respond to questions. Use that as an opportunity to engage the user in live conversation and up-sell consulting services on a fee-for-service basis.
(Implementation: Medium)

Create a trademark service

Build a trademark service through Slack. A bot could search trademarks in the USPTO database, collect the information it needs to file a mark, collect payment, and then monitor and provide updates on the mark. Loop in a human paralegal when the USPTO has issues and requests changes to the filing, then resume the bot to provide further status updates from the USPTO.
(Implementation: Harder, but likely worth the time.. This one feels lucrative)

Let’s create a human + AI messaging experience

I’m going to show you how to create a human + AI messaging experience using Botkit + Janis.

We’ll use Glitch (Formerly GoMix) to host and deploy the app. Glitch is a web-based code editor that features instant deployments, so you can edit, host and test your bot’s code in one place.

Step 1) Add Janis to Slack

To get started: Add Janis to Slack

Step 2) Tell Janis about the bot you’re going to build

Once you add Janis to Slack, follow the prompt to Add a Bot (You can also say “Add a bot” at any time to Janis).

3) Get Keys From Janis

Janis will give you a Client Key. Each bot deployment has it’s own unique Client Key.

4) Create a new Slack app

Click Create New App at https://api.slack.com/apps. After you’ve chosen a name and which team your app will live in, note the Client ID and Client Secret from the App Credentials view. You will need these to get your app up and running.

Once you’ve collected those keys, set up your default username in the Bot Users section and save your changes to continue:

5) Start a Glitch Project

You can remix this Glitch project you can test things out quickly and you can continue to build on it later.

https://glitch.com/edit/#!/wordhop-botkit-starter-slack

Click the title of the project in the top left corner and it will give you the option to Remix This. Click that to make the sample project your own. This will copy the BotKit Starter Kit into a new project that you can save with your own name.

6) Add your Keys to your Glitch project and run

Glitch safely stores your keys in an .env folder. Paste your clientId and clientSecret values in here. Also add your Janis Keys for the specific bot deployment. Don’t worry — if anyone remixes your project, your keys won’t be shared.

lizard-gymnast was the name Glitch gave my project by defauilt

Once you’ve included your app credentials, click Show Live to get your bot server running. This will start up the Glitch instant hosting and deployment magic. You’ll need to have this server running for Slack to confirm your app’s endpoints and finish your configuration.

7) Get your app talking to Slack

Now you just need to get your environment variables set so your app and Slack can communicate with each other.

Configure permissions

Return to your Slack app settings and navigate to OAuth & Permissions.There, paste in your Redirect URL, which is your own, remixed Glitch URL plus “/oauth”, like this example:

https://lizard-gymnast.glitch.me/oauth

You can grab the URL from Glitch by clicking the “Copy” button

Copy the URL from your browser window and paste into your settings.

Save your changes and confirm your Redirect URL to continue.

Add a Bot User

Create a username and enable the Online notifier in the Bot Users section.

Enable Interactive Messages

You’ll want to enable Interactive Messages for your app, so go ahead and do that too. That would be your Glitch URL, followed by “/slack/receive”:

https://lizard-gymnast.glitch.me/slack/receive

Type that URL into the Request URL field to enable Interactive Messages.

Enable and subscribe to Slack events

Now go to Event Subscriptions and turn the toggle on to enable Slack events! Paste in the same Request URL you used for Interactive Messages.

Now, subscribe to the events your apps requires below. For the purposes of this example, we’re going to subscribe to some Bot Events that allows this bot to hear messages wherever they’re posted.

Subscribe to events in Slack

Now…

Add your new app by clicking the “Add to Slack” button and select a team. If you’ve configured everything correctly, you’ll see a screen like this one:

“Best Team” is a Slack team name we made up for this article, but you really are the best team if you’ve made it this far

Authorize your bot and you’re good to go. To test your integration, send your new bot a command you know it won’t understand and look for a “No Response” alert in in the Slack channel where you added Janis.

Congratulations! You just created a basic hybrid human + AI conversational app with Glitch using Botkit + Janis.

Recommend, or share this if you found it useful. It gives me 🔋 to write knowing people find value in it.

--

--