The integrations are used to add features to Slack. There are four custom integration tools : incomings webhooks, outgoing webhooks, slash commands and bots users. The one to choose depends on what you need to do:
- : it’s the role of the incoming hook. For example, Cyril wakes up every Thursday afternoon to gather two by two all the users who are active on #general.
To create an incoming hook, you just have to choose a default channel, where all the notifications will be sent. Then, you get the generated webhook url, that you’ll use to send messages.
- : the outgoing hook and the slash command can do that for you. Zizou is an outgoing hook: he responds when somebody posts a message started with the trigger word fifa. For example, this is what you get if you type fifa ranking :
If Zizou responds to a specified trigger word, it’s not necessary the case for all the outgoing hooks: they can respond to any message posted in one channel, specified when the hook is created.
Tony is a slash command: it is linked to the command /tony, that we can type in any channel to get our meeting rooms’ availabilities:
- : you need a bot user! More complex, they enable teams to conversationally interact with external services in the form of a conversation; SlackBot is one of them.
The bot user is like a limited user, without a real Slack account. He has its own token to access Slack resources, intercept real-time events and send messages.
|Integrations||For what?||To set at the creation||To get at the creation|
|Incoming webhook||Send notifications on Slack||Target channel||Webhook URL|
|Outcoming webhook||Request an external service||Target channel and/or trigger-word(s)
|Slack command||Request an external service||Name
|Bot user||Interact with users||API token|
All the integrations look like users; in particular, you can change their names and avatars.
Slack provides a Web API to enhance the integrations. It presents methods which allow to interact with Slack, getting users’ emails or archiving channels, for example. These methods are gathered in scopes. For example, the scope user:read includes methods which allow to list users, get users’ information and know if one user is active or not.
Slack offers the Real Time Messaging API as well, based on WebSocket. The bot users use it to get events from Slack, once they’re connected to the server. These events are almost anything that can happen on Slack: the bot can receive an event when a user write a message, upload a file, create a channel, etc. Once triggered, the bot can process events programmatically.
Not anyone can request these API: you need tokens to do that. The bot users have their own tokens; regarding other integrations, you need to generate a token on the dedicated interface.
The Slack integrations allow you to add features usable by your own team. But if you want to spread them, you need to create an application. You’ll be able to combine many custom integrations and access the information of other teams’ users.
Regarding Tony, we wanted to add complementary services to the consultation of the availabilities of the meeting rooms. We decided to build an application for this purpose. Once users have authorized Tony to view their agendas, they can:
- add Google calendars as rooms
- get the meeting rooms availabilities
- obtain one slot in the day when they can organize a meeting with the people they want, and, if this slot exists, create an event for this meeting
It’s easy to create an application: you just have to fill the form provided by Slack, choose a name for your application et describe it.
Slack provides the Slack button, which can be included in a web page. Users just have to click on this button to add the application to one of their teams. They will be redirected on a specific page, where they will have to log in to Slack. They will have to accept some permissions asked by the application: that will trigger the process for obtaining a token (OAuth 2.0 protocol).
At the end of the registration process, the application can access users’ information, with the token: the users don’t need to authenticate each time. This token never expires.
Slack offers at this stage to publish the application in the App Directory. Like the Play Store or the App Store, the App Directory may help users to discover an application and hence bring you more user. The submission form can be found in the management interface.
Besides the developer’s name and the Client ID of the application, you’ll have to give some information:
- link to install instructions
- link to support page
- description about what integrations do in your application
- list of scopes requested by your application, and why
Once the form is submitted, the Slack team will validate it (or not). In any case, users will be able to install your application as this stage is not mandatory.
All that remains for you is to add your Slack button to your website, like this:
And it’s done, your app can be installed by any team on Slack!
Slack offers an easy and efficient means of spreading applications on its platform: if the logic part of your application has already been developped, you just have to implement an interface to “connect” it to Slack. In our case, Tony is available on Slack, but we also speak with him through Amazon Echo!
If that makes you want to build your own application, then go for it.
If you have questions, or even suggestions about Tony, feel free to contact us.Contact Applidium on Twitter