look carefully

Integrate Your API.AI Bot With Slack

It’s really easy and powerful to work with API.AI as a tool for creating your bots. Not only you are getting a powerful machine learning algorithm to understand your users, you get in the same time an easy way to integrate with many services (e.g. Google Home, Twitter, Facebook messenger, Slack, Telegram, Skype and many more).

What is API.AI?

API.AI is a natural language understanding platform that makes it easy for developers to design and integrate intelligent and sophisticated conversational user interfaces into mobile apps, web applications, devices, and bots.
If you never worked with API.AI – You can check it out in this post.

What is Slack?

I just copied from this site, because it’s short and to the point:

Where workhappens.

*Whatever work means for you, Slack brings all the pieces and people you need together so you can actually get things done.
If you are a developer that worked with IRC in the past – Slack is a (much) ‘nicer’ version of it. You get the productivity of a mobile chat tool with many options for integrations and automations.

Now, that we got the tools defined, let’s see how to integrate API.AI and Slack in nine elegant ‘dance movements’.

  1. Create a new Slack App by using the link. You will need to have an account so make sure to create one and login with it.
  2. In the Slack App, go to the ‘Bot users’ section and click the ‘Add a Bot User’ button.
  3. Enable events in the ‘Event Subscriptions’ section.
  4. Select necessary events in “Subscribe to Bot Events” section.
    Popular events you might wish to listen:

    • message.im
    • message.group
    • message.channel
    • im_created

      These events will define which message types (direct, in channel, etc.) your bot will react to. After you making your selection, remember to save changes.

      (!) It’s important to choose the minimal (but functional) set of events you want to subscribe. Since you don’t want to have too many events that aren’t necessary and might intimidate the user when she installing your bot.

      See below an example:

      And for bot events you want something like:

  5. Now, go to ‘Basic Information’ section, copy the ‘Client ID’ and ‘Client Secret’ and paste their values into the respective fields below.

  6. Start the bot. You can see it in the above image. It’s the last step at the bottom of the dialog.
  7. Copy the ‘OAuth URL’ value below and paste it into the ‘Redirect URL(s)’ field from the ‘OAuth & Permissions’ section of your Slack app settings.

    Save URLs.

  8. Copy Events Request URL from the field below and paste it to Request URL in the ‘Events Subscription’ section of your Slack app.
  9. In the Slack app settings, go to ‘Manage Distribution’ and add the bot to your Slack team using the ‘Add to Slack’ button.

That’s it!

Give it a try in your Slack right now, while it’s all fresh in your mind.

You can create a new channel (e.g. #test) to try these new bots.
I created a little bot that tell good animal jokes so if you wish to get some good jokes, you can install it from here.

Good luck!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s