DEV Community

Naveen Honest Raj
Naveen Honest Raj

Posted on

Help with getting started in building bot for Slack

I am trying to build a bot for Slack. I somehow managed to do the MVP version of it using Python's slack event API library slackeventsapi

Today in an evening discussion, my friend suggested that I should probably try my hands with Hubot or Bolt framework in JS for building slackbot because those frameworks makes use of RTM(Real time messaging). The discussion couldn't go further because of some time constraint. Now I have been googling around to try and understand what kind of pros I'll get over choosing one over other and why?

If someone could help me by explaining it in a bit easier terms, it would be so helpful. Thanks a lot :))

Top comments (6)

Collapse
 
brandinchiu profile image
Brandin Chiu

This discussion will be heavily dependant on what you're trying to do with your "bot".

A Slack "bot" is more or less just an application that responds to API requests. The only main difference is that the API requests are coming from Slack.

The users interacting with the bot in some cases aren't actually "messaging" the bot -- they're invoking actions in Slack that translate into commands that are interpreted and responded to by the bot (and the application backing it).

For example, the easiest to build bots simply listen for commands being entered into the chat window in Slack (like /dosomething or /takesomeaction). These are trivially easy to set up.

Collapse
 
nav_devl profile image
Naveen Honest Raj

Thanks for the quick reply.

So what I am trying to build with the bot covers something like, fetching from an external resource and show up in Slack Bot's Home page and also enable the bot to receive commands and process them. Mostly with Home Page open event and command event is what my bot's purpose is defined with.

Collapse
 
brandinchiu profile image
Brandin Chiu

If your bot doesn't actually need to "communicate" with users by interpreting arbitrary text, then you might simply need to build a slack "app" which is much easier to work with and can be backed by anything.

It's essentially just an api you build with a slack frontend.

Have you started the process of actually creating the "app" in the slack interface yet?

Thread Thread
 
nav_devl profile image
Naveen Honest Raj

Understood. Understood. So there are only few scenarios where the RTM focused frameworks allows us to easily use them powerfully. Am I right?

Yes, I have started using the Python's slack event API in combination with Flask. The MVP is 80% done. I just wanted to try out and learn it in the process.

Thread Thread
 
brandinchiu profile image
Brandin Chiu

RTM is very rarely needed for most slack apps. The majority use webhooks and http requests to trigger activity.

Thread Thread
 
nav_devl profile image
Naveen Honest Raj

Understood understood. Thanks a lot for helping to see me things with better clarity.