Pinterest Stumbleupon Whatsapp
Ads by Google

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 Get More out of Slack With These 7 Tips Get More out of Slack With These 7 Tips With a clever user interface, Slack makes a potentially complex workflow simple and intuitive. It has redefined communication. Make better use of Slack with these tips. Read More — until now.

If you’ve never heard of Slack Slack Makes Group Communication Faster and Easier Slack Makes Group Communication Faster and Easier Group emails can really kill productivity. It's time to put mail clients to rest and use collaboration services like newly launched Slack. Read More , 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 Which Programming Language to Learn - Web Programming Which Programming Language to Learn - Web Programming Today we're going to take a look at the various web programming languages that power the Internet. This is the fourth part in a beginners programming series. In part 1, we learnt the basic of... Read More to learn how to do this. You don’t even have to be particularly tech savvy.

Ads by Google

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”.

slack-commands1

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.

slack-commands2

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 How Much More Productive Is ToDoist Premium? Here Are 6 Good Reasons To Upgrade How Much More Productive Is ToDoist Premium? Here Are 6 Good Reasons To Upgrade I kept using ToDoist for free for a while. But kept coming up against things I wanted to do and couldn't. Email reminders. Adding notes to task. Things that would really add a whole lot... Read More , 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 Tasker and IFTTT: The Perfect Automation Duo For Android Tasker and IFTTT: The Perfect Automation Duo For Android Tasker automates anything you can think of on your Android device and IFTTT automates Web services. Used together, there's nothing you can't do. Read More 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.

slack-commands3

Then choose Slash Commands from the list of integrations.

slack-commands4

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.

slack-commands5

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 How To Use Slack For Project Management With These Simple Tips How To Use Slack For Project Management With These Simple Tips With Slack's clever set of features and distraction-free UI, the platform can double up as a project management tool for many people. Learn how to set it up as your online personal assistant. Read More .

Using the POST method, Slack will send that information to the external service using the “text” variable, as shown here:

slack-commands6

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 How To Build An Email To RSS Notification Machine With Zapier How To Build An Email To RSS Notification Machine With Zapier We've previously covered different ways to create automatic workflows that separate important tidbits of information from the mundane. This article is about how you receive the information. The most obvious (and often also the easiest)... Read More .

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.

slack-commands8
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.

slack-commands9

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.

slack-commands10

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.

slack-commands11

After identifying your POST data, you’ll see the sample show up where the Test button was previously under step 6.

slack-commands12

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.

slack-commands13

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.

slack-commands14

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!

slack-commands15

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 OneNote Is Now Truly Free With More Features Than Before OneNote Is Now Truly Free With More Features Than Before Evernote no longer rules the roost of note taking apps. Microsoft recently announced OneNote would be more free than ever before. Let us show you what this means in terms of features and functionality. Read More , 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!

  1. bdrn
    July 20, 2016 at 4:17 pm

    I've created a custom slash command that pings Zapier, which in turn posts to a specific channel. Works great, but every time it's used, Slackbot responds to the individual user with a status message, like this:

    "slackbot {"status": "success", "attempt": "5761bb6a-ba4b-4021-9be6-a41fdf036fe0", "id": "fae21631-c46e-426e-a508-ab3059afcd03", "request_id": "DLGHGcuUfWOfM7GR"} Only visible to you"

    Have you experienced that and is there anyway to suppress this?

    Slack says to return an empty response with a 200 status code, but nowhere in either the slash or Zap config is there an option for changing the intial response to Slack

Leave a Reply

Your email address will not be published. Required fields are marked *