Over a million developers have joined DZone.

How to Build a Watson-Powered Tone Analyzer Slack Bot

DZone 's Guide to

How to Build a Watson-Powered Tone Analyzer Slack Bot

Learn how to build a Watson-powered tone analyzer Slackbot that can understand the tone of a conversation and respond to you appropriately.

· AI Zone ·
Free Resource

This blog will help you build a Watson-powered tone analyzer Slackbot that can understand the tone of a conversation and respond to you appropriately. This use case can be further extended to customer support chatbots with which you can understand the tone of the conversation and respond to customers.

Image title

Let's understand the technology that is powering this bot.

The Watson Conversation service helps you build and deploy chatbots that can understand natural language input and that uses Machine Learning to respond.

The Tone Analyzer service detects tones (emotional, social, and language) in written text. It can analyze tone at both document and sentence levels.

The steps to create a tone analyzer Slackbot are:

  1. Create a Slack team.

  2. Create a custom Slackbot.

  3. Create a Bluemix account and create the app.

  4. Configure Watson Conversation Service.

  5. Configure Node-RED.

Below, these steps are described in more detail.

1. Create Slack Team

You can follow steps to create a Slack team here.

You can ignore this step if you have an existing Slack team with admin permission to create Slackbot.

2. Create Custom Slackbot

You can refer this link to create custom bot users

Or, click on this link to create a bot.

Start by choosing a username for your bot and click Add bot integration.. Take a note of the API Token section, which is required in later steps!

3. Create Bluemix Account and Create App

Sign up for the IBM Bluemix 30-day free trial to create the app.

Ignore the previous step if you have a Bluemix account. Sign in to Bluemix and go to Catalog. Then, select Node-RED Starter in the Boilerplate section.

Enter a unique app name and host name; then, click Create.

On the next page, click Visit App URL, which will redirect you to a new page. Keep clicking Next until you reach the Node-Red Flow Editor page. In between, you will have to enter the username and password to make your Flow Editor more secure.

Go back to your Bluemix App and click Connections. Then, click on Connect New. It will redirect you to Catalogs. There, search for "conversation service" and click on it. Enter the service name or leave it at its default and click on Create. Repeat the same process to connect the Tone Analyzer Service to your Node-RED app.

4. Configure Watson Conversation Service

Go to Conversation service that you created in Bluemix and then check out this video to configure Watson Conversation Service.

Image title

5. Configure Node-RED App

Import the Node-RED flow from here to your Node-RED Flow Editor. Then, edit the Slack API token in the Slack Request and Slack Reply nodes and the Conversation Workspace ID (can be found in Conversation Workspace Tool). If Slack Request and Slack Reply nodes are not present, go to the right side (three lines) of your Node-RED Flow Editor and then click on Manage Palette. Search for Slackbot and install it.

Once you are done with these steps, click Deploy in the Node-RED Flow Editor.

Now go to your Slack team. You can see that your Slackbot is online. Start chatting with your custom Slack bot!

chatbot ,slack ,ai ,tutorial ,watson ,tone analyzer

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}