IBM Watson’s Personality Insights and Howdy.AI’s Slackbot tutorial
{intro: start}
Chances are if you work in tech you know what it’s like for your work to not be understood by the vast majority of people. Odd acronyms like API, OKR, or CRM, funny words like SCRUM and backlog, and titles like dev evangelist usually take a bit of explaining. I’m pretty confident my entire family has never actually understood what I do. “You make the internet, sweetie. Good job.” Thanks, Mom.
And then you know those times when you find yourself amongst friends and you can just let those acronyms fly without skipping a beat? And find humor in jokes about the CLI or bash scripts (I know, right!?). Well, late last October I found that in the first ATX Bot Talk Meetup hosted by Howdy.AI.
It was a darn good meetup: A decent sized crowd, but not so many that social anxiety kicks in; friendly with a few familiar faces; good topics and speakers; reminiscing about good ole’ IRC. Pizza. Beer. What more do you need?
Jeff Kramer presented on how to make your own Slackbot using Python. I’m of course a fan of Slack and thought to myself, “Yeah! That looks fun!” And off I went.
Full disclosure—in another life I was a developer. I’ve always enjoyed it but it has been more than a couple years since I was coding day-to-day. And for me it’s not quite like riding a bike. As one friend commented, it’s more like riding a bike that has been sitting in the rain for a few years. Yes, that’s more like it.
Still, the Slack API is stupid easy to use. IBM Watson’s Personality Insights is easy to use, and with Howdy.AI’s botkit even old timers like me can get something going pretty quick.
For this walk-through let’s find the personality of a channel using natural language processing.
{tutorial: start}
First things first, let’s get all of our credentials ready and that handy dandy Slackbot kit using the docs here. Make sure you have Node.js and NPM


Then head over to Slack and get your bot integration going. For this example I’m going to use our IBMWatsonDevs Slack.
Go to Integrations:


and add your bot to get credentials:


Grab your API Token. Give your bot a name & icon.


Now let’s get Personality Insights setup. All of IBMWatson’s APIs are hosted through IBM Bluemix, IBM’s PaaS, so our next step is to head over to Bluemix.
Go ahead & signup:


And then login after you get your IBM ID:


Now we need a space to host our Personality Insights service so we can get our credentials. Let’s make a space:


And then add a service:


Now add Personality Insights:


Now create your space. Be sure to leave the app unbound. Note that Personality Insights has a few tiers for pricing but is free for the first 100 API calls per month.


Now you’re able to grab your service credentials. Keep these handy:


Alright, now we’re almost ready to start cookin. Let’s get the IBMWatson Node.js SDK


So now we have our botkit and Watson ready to go. Let’s get those credentials in there.
Find the file hello_world_rtm.js from your botkit. Let’s add Personality Insights credentials:


This snippet is where your Slack token is going to get called:


Now, each Slackbot has to be invited to a channel to use it. So I type in my bot’s name and then invite the ibmwatson_bot:




Remember that Slack token? Let’s use it to get our bot online:

You’ll notice in Slack when a bot is online. It changes from this:


To this:


So you should have the RTM API going now:
{tutorial: wrap up}
Now let’s actually make stuff happen. Check out this code that has the bot listen for “Hi Watson”


Let’s try it out:


Sweeeeet. You should also see some information in your terminal relating to the users, channels, and conversations. Each one gets a unique identifier which you can use to call or access if you want.
Now check out this code that relates to the Personality Insights call:


Now try it in the Slack channel:


Dang! Our channel is not very agreeable, is it?! It’s like we’re a bunch of developers or something.
You’ll see Personality Insights returns in your terminal, too:


That’s it! Now we know the personality of the channel.
If you don’t want to keep passing in the token each time you can deploy this back to Bluemix or another PaaS.
{tutorial: end}
The Howdy.AI Botkit has many more features and IBM Watson has a bunch more natural-language processing tools if you’re interested. You can also head over to my Github to see the whole project.


Overall great project to get my terminal window open again. It’s interesting to only use the Slack interface and command line for a project, so I hope this tutorial was helpful. I hope to work on more starter projects and begin coding more. Thanks again to the help of Ben at Howdy and Jeff Stylos at IBM.