How to start developing a slack bot with interactive buttons

And how you can do that through https proxy.

Kirill Shevchenko
Feb 11, 2017 · 2 min read

In summer 2016 slack introduced API feature for making bots with interactive messages. I think it is not necessary to explain why it will help to create a more user-friendly bots.

Just look at examples:

Image for post
Image for post
text commands flow
Image for post
Image for post
buttons flow

Your bots won’t have to parse human language as much if you let users make direct choices. The result is a new way of building apps for Slack, one that relies less on complex multi-step interactions, while letting you increase user engagement — Slack Developer Blog post.

Now we’re gonna see how to develop a bot with this cool new feature.

API for message buttons well documented and looks easy to use. But the problem is that it is required to use http connection in order to send responds to our bot.

Image for post
Image for post

Though it is really hard to set up this in local environment. Fortunately, there are a few solutions, for example the localtunnel. During development this tool is useful for temporarily exposing a compatible webhook url.

Localtunnel allows you to easily share a web service on your local development machine without messing with DNS and firewall settings.

Run your bot for example on 9292 port and then type:

And get a link like this

Which you can put into section “Interactive Messages” on your slack app settings. And start developing in local environment.

Image for post
Image for post

Now everything seems to be fine, but turns out the localtunnel doesn’t really work well and sometimes crashes. To resolve it I made a gem localtunnel-restarter which keeps localtunnel working.


If something happens with proxy server it will be automatically restarted with subdomain and port from options.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store