The Ultimate Way to Make Slack Work with Your Favorite Services
Slack is fast becoming one of the most popular chat platform for teams and communities. In addition to communication there are many ways to unify information inside Slack, but there are few integrations that let you control external services from within Slack — until now.
If you’ve never heard of Slack , then it is time to take a closer look at it for your (team’s) communication needs. Sure, email is great for group conversations, and IM is fine for one-on-one or small group meetings, but both of them have drawbacks that Slack overcomes.
An email conversation can take days while you wait for people to check email and respond. IM requires that participants stay tied down to their computer until the communication is over. Slack has neither of these requirements.
And now, thanks to a powerful Slack integration called “Slash Commands“, you can issue either POST or GET strings via URL to any external service that can receive it.
Don’t worry – you DON’T have to be a programmer to learn how to do this. You don’t even have to be particularly tech savvy.
It’s basically three steps, and you can do something as cool as creating your own custom Slack command (a slash command) that posts a new task to ToDoist. Or issues a new Post to the company Facebook Page. Or adds a new event to the company Google Calendar!
Understanding Slack and Slash Commands
If you’re unfamiliar with Slack, it’s a collection of “channels” – aka topics – where people can join in and take part in the conversation at their convenience. In addition to just typing in text while you’re chatting with people, there is a list of built-in “commands” you can issue. You just need to precede the command with a slash – hence the name “slash commands”.
These are commands like
/leave to leave a channel,
/feed to have an external RSS feed post to a channel, or
/giphy to utilize the Giphy integration and post funny animated GIFs in the conversation. In fact, most commands and integrations are focused on posting information from external resources — files from Google Drive or new to-do items added to Wunderlist — into the Slack conversation.
But what if you want to utilize Slack itself as a more powerful “command center” for all of the external services that you use?
Slack doesn’t really provide many good integrations for this. Many are promised – but I think they are stalled because the Slack team prefers to keep the conversation inside of Slack, and isn’t so interested in enhancing the other services across the web.
This is flawed thinking though, because if people could be more productive from inside Slack, they would spend more time there, rather than log into those external services.
Case in point — at MakeUseOf we have a system where editors will recommend authors for a bonus, for writing articles that are particularly high-quality.
Normally they would send me a direct message (DM), recommending the bonus. I would then have to copy and paste their message, log into my ToDoist account
, and add it to my list. It’s annoying and tedious. Wouldn’t it just make more sense if I could just type in something like “
/todoist <task description>” and have it automatically add to my default to-do list?
Better yet, what if I could customize a command called “
/author-bonus” or something like that, and let the editors directly add those recommendations to my ToDoist account themselves?
Well, using the available (but somewhat limited) Slash Command integration from inside Slack, and the free plan of the Zapier service (similar to IFTTT but a little bit more powerful), you can do that kind of thing. As I’ll show you, setting up the Slash Command and the free Zapier account to do this kind of thing is very easy — and it can extend to an amazing array of other web services you may be using, not just ToDoist, and not just to-do lists.
Configuring the Slash Command Integration
How do you create these custom commands? It’s actually easier than you may think.
First, take a look at your Slack Integrations area by clicking on the down arrow next to your Slack community name, and choosing Configure Integrations from the list.
Then choose Slash Commands from the list of integrations.
Click on the Slash Commands integration to get into the Integration settings. Setting this up is easy.
First, just name the command. In my case, I’m going to call it “
/abbonus“. This will be the command people will type to trigger your integration. The next line — the URL — is the most important one. Choosing between GET or POST is also important; as it depends on the service you’re trying to trigger with your custom command.
The integration screen also provides you with a special “token” code if the other service you’re integrating with requires it. We’ll get to how you figure all of these things out in a moment — but first, keep in mind that what makes this custom code so flexible is that you can pass information to the external service using the command.
For example in this case, I’m going to set it up so people can type “
/abbonus <Article-Title>” in order to pass the title of the article that deserves a bonus into the Managing Editor’s to-do list
Using the POST method, Slack will send that information to the external service using the “text” variable, as shown here:
So, leave these windows open. You need to set up the other service in order to get the correct URL format to paste here. Let’s take a look at that, and then return to this step at the end.
Using Zapier to Do Cool Things With Your Command
So, there are some sites like Facebook or Twitter that will let you send POST URLs to them – but they are very specifically defined. For example for Facebook, you have to pass a string like this:
http://www.facebook.com/sharer/sharer.php?u=<url to share>&t=<message text>
And then it’ll automatically share a link under your currently logged in account.
The GET method in the Slash Commands integration you set up would allow you to pass such a URL. The limitation though, is that Slack will only send the token, team_id, team_domain and other variables using those exact variables. There’s no option to define a “u” or a “t” variable.
That’s unfortunate, but thankfully there’s a service called Zapier that allows you to issue it very flexible POST commands. Simon wrote about Zapier once, as a service he used to build an RSS notification machine .
The Zapier team have programmed an awesome tool called “Webhooks by Zapier” that can literally analyze any POST command you send it, and it’ll understand the variables automatically. To set this up, just “Make a Zap!” and then search for and choose Webhooks by Zapier.
Under this, select the dropbox and choose “Catch Hook”. As you can see, Zapier is capable of accepting a POST, PUT or GET when you want to pass information to it. On the right side of this same page, you can choose whatever service you want to trigger an action for. In my case, I want to automatically add a task in ToDoist, with the text that was passed along with the Slack command.
Back to the URL you needed when you were setting up the Slash Command integration in Slack. Step 2 of the “Make a Zap” process gives you the URL that you need.
Copy this URL. Go back to the Slack integration page, and paste it into the URL field and Save the integration. Then, go into any of your normal Slack channels and test it out using your new command. This will send a test POST to Zapier.
Then, go back to Zapier and in the next step, you’ll see a button to “Test Webhooks by Zapier trigger“. This will check the queue for any commands you’ve sent, and analyze the POST for available data.
After identifying your POST data, you’ll see the sample show up where the Test button was previously under step 6.
If you see any Samples show up, that means Zapier saw the communication from Slack and you’re good to go!
In fact, if you scroll up to Step 5 again where the ToDoist fields are set up, you’ll notice that when you click on “Insert fields”, Zapier now shows all the data that your Slack command has sent. As you can see, the “Text” parameter following the command gets passed and recognized by Zapier.
As you can see in the screenshot above, by configuring the command text to get passed to ToDoist as a new task, anything following the /abbonus command in Slack will become a new ToDoist Task! It’s that simple.
Testing the Slack to ToDoist Integration
Now that you’ve created the Zapier “Zap”, the command is ready. The cool thing about this is that you can create integrations that aren’t even currently offered by Slack.
For example, Slack doesn’t offer a ToDoist integration — especially not an outgoing one. By using the procedure above, you’ve just created one!
Test it out. Just go into Slack and in any channel, type your command.
In my case, it’s the bonus command followed by the name of the author and then name of the title to give a bonus to.
Logging into my ToDoist account, I can see that the new task has magically appeared in the todo list!
This is just one integration that’s possible using the Slash Command integration in Slack. Any service that can receive a POST or GET web hooks could potentially be integrated. Using the power of Zapier as described here, you can even integrate services that don’t accept GET or POST commands — because Zapier does that part for you. Go ahead, integrate Slack commands with services like Google Calendar, Gmail, Google Drive, OneNote , MySQL, Twitter, Facebook, and more.
The only drawback to having to use Zapier is that the free account only allows 100 tasks a month. If you are not a small business, this is plenty for an individual. The basic plan starts at $20/month and goes up from there.
Have you benefited from interesting Slack integrations? What are the creative Zapier integrations you have set up? Share your own tips and advice in the comments section below!
Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.