Distributing a slack app

Fred Hawk
Chatbots Life
Published in
5 min readJul 2, 2017

--

A little post about the process of distributing a slack app.

Bot building and distribution

Create a slack team for development

First you will want to create a slack team for development.
Go to slack.com and create a new team that you can use for your bot testing.

Create a slack app

Next up is creating a slack app.
Visit api.slack.com and go to “Start building”. This will take you to the app building section where a modal will pop up asking for your apps name and the development team.

NOTE: The development team can not be changed. It is the team that you created in the previous step.

Add bot to your team

You will see a screen now with some basic information about your app such as:

  • Basic information
    - Here you select which slack app features your app is going to use.
    - For instance a slash commands bot will need the slash commands functionality.
    - Add app to your development team here
    - Distribution of app to the slack app store
Basic information interface
  • App Credentials
    - Tokens needed for hosting and so it can access the slack API
  • App Display Information
    - Name and description of the app.
    - Avatar to display in the slack chat

Begin with selecting the functionality that your app is going to need. For instance slash commands.

Create a new command.

Commands section

You will need to enter some information for your bot.
For example the first thing is which command should the bot react on?
It can be anything but has to be a single word. “/yay”

Request URL you can enter http://localhost/ for now but later you would want to enter the ngrok url here if you are using that. Later on you will put in the hosting URL here.

TIP ngrok is awesome! Highly recommended.

Fill in a short description and finally a hint that will be shown in the slack chat when someone enters a slash.

Don’t forget to save.

Now you can go back to the “Basic Information” in the menu to the left.

Menu for slack

Now it will instead of showing the different functionality options it is now closed and a green check mark is there.

This means you have successfully filled in the information needed in that section.

However you can use more then one function so you can open it up again and add more if you need it.

Now you can go to “Install your app to your team” and just press the Install app to team button. Authorize the app and it is now available in your team.

Now you can develop your bot. This will not be covered in this post but there are excellent guides on that here

When you have your app working proceed with uploading it to a host like Heroku.
At Heroku, on the app you created there, under settings. There is a section called Config Vars.

Here is where you enter your slack client ID and your slack client secret.These are the Slack App Credentials we mentioned before.

This step will generate a URL for the site where you can add the bot to a team. The apps homepage so to speak where people can read about it.

Add route to your bot that handles authentication of the bot.

In you bot on the server end. Add a route which handles authentication requests. This is needed for people to authenticate when they add your app to their own team.

Add the slack button route for authentication to your bot. (Example /slackauth), this will be a special route for authentication. It will be a route at the end of your hosting route. For example https://super-bot.herokuapp.com/slackauth.

Time to distribute!

Now for the big finale.
Press the distribute section and follow the steps.

One of the things you will need is a redirect URL. This is a URL that people will be directed to when they have added your bot successfully to their team. We are talking about in the browser.

It is advised to create two of these, one for success and one if it fails so users won’t be confused by what happened.

Through the distribution step you will get html at the end for a slack button that has the appropriate information to add the app to someones team.

End of distribution gives the html code for adding a slack button to your slack apps site.

Add this html to your slack apps homepage. Makes it smooth and easy for anyone to add your app to their team, provided that they authenticate.

Test that everything works.

Done! You have successfully created and distributed a slack app!

--

--