How to create a custom slash command for Slack.
4.7 (5 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
21 students enrolled
Wishlisted Wishlist

Please confirm that you want to add How to create a custom slash command for Slack. to your Wishlist.

Add to Wishlist

How to create a custom slash command for Slack.

A lot of your organisation can be automated from within Slack by having slash commands trigger external scripts.
4.7 (5 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
21 students enrolled
Created by Andrew Golightly
Last updated 6/2016
Current price: $10 Original price: $25 Discount: 60% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 1 hour on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Create your own custom slash command for Slack
  • Setup a public facing Node.js Express server
  • Save time by automating common processes
View Curriculum
  • Intermediate knowledge of Javascript.
  • Some experience using Slack.
  • You will either need to have your own server already or be prepared to setup a Droplet on DigitalOcean.

Want to save yourself hours of time in boring admin tasks so you can concentrate on your real job? 

Did you know you can use Slack as a command hub from which to control external services and systems? 

You can use this powerful functionality for a wide range of things, from initiating an action in your project management system to kicking off an automated email campaign. 

This course specifically will teach you how to create a custom slash command for Slack.

For example, you can setup a slash command that looks like

/bill 2.8 fixed jumpy header

that will automatically add that billed time (2.8 hours) with that task description (fixed jumpy header) against a client in your accountancy system. Slack sends the text entered together with the channel name it was sent from, so your script could match the channel name to your client's name in your accountancy package.

Super simple. Super clean. Super powerful.

Course Structure

The course is made up of a series of step-by-step screencasts of the course creator creating a slash command. We'll start from scratch to give you a very clear understanding of the development process and workflow for creating a custom slash command.

There is about an hour's worth of video content broken up into 14 discrete sections, making it very easy to complete the course at your own pace.

What We'll Build Exactly

We'll create a weather slash command.

  • /weather <city>

This will allow someone to type something like /weather Cape Town which will display the weather for that city within Slack. This is a simple script, but will give you the basic framework on how to have a slash command call a server that calls an external service, perform any action and return some data to Slack.

An Overview of the Workflow We Will Build:

  1. Setup a Node.js server that does something (like calls another API based on the parameters passed in by Slack) and returns some JSON data back to Slack.
  2. Configure a custom slash command for a Slack account: what the slash command is to be called, what address to post to (the above Node.js server).

Skills You'll Learn

  • Build on your experience of Javascript and learn new features of the next version: ECMAScript 2015 (ES6)
  • You'll set up a Node.js server with Express on DigitalOcean.

I look forward to helping you automate a lot of those repetitive tasks you normally perform in your business!

Note: This course is not created by, affiliated with, or supported by Slack Technologies, Inc.

Who is the target audience?
  • This course is for users with some Javascript programming experience that want to automate and manage external services from within Slack.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
1 Lecture 04:59

A brief overview of Slack, an introduction to custom slash commands, how custom slash commands can help save you time by automating tasks (such as using the Trello or Freshbooks API), and what we will be building in this course.

Preview 04:59
Developing the custom slash command
8 Lectures 28:16

My development environment:

  • I work on a Mac
  • I use iTerm2 (
  • We will be using Node.js (
  • I use the Atom editor (
The development environment

We will create an account with to get our API key.

Get an OpenWeatherMap API key

Starting to code by adding in a few comments to state what we intend on doing. We will use ES6. In this video we test to make sure that Node.js can run our code.

Starting to code up our slash command in Node.js

Here we use axios ( to actually perform our GET request to OpenWeatherMap to return some data.

Using axios to make a GET request to OpenWeatherMap

Here we setup an Express server so that our city to search on can be passed through the URL.

Preview 05:39

Passing the GET request parameter that Express receives (the city) to axios.

So we can now call our Express server with /weather?text=Paris and get that to actually return weather data for that city.

Integrating the OpenWeatherMap GET request with Express

An introduction to the Message Builder in Slack ( This video we work out the JSON that Slack requires that matches how we want our weather report to be rendered in Slack.

Building the JSON response to render nicely in Slack

In this video we integrate the JSON structure we worked out from the previous video, into our script. So that our Express server returns that exact JSON object populated with the data we receive from OpenWeatherMap.

Integrating the JSON object into our Express server code
Configuring Slack to communicate with a server
3 Lectures 16:51

Here we package our script into a package.json file. Specifically we specify our dependencies in this file.

Packaging our Express server

Here we setup a Droplet on DigitalOcean with Node.js, secure copy (scp) our files to our server, and install our script dependencies.

Preview 05:59

Here we configure our Slack account with our new slash command.

Configuring Slack to issue GET requests to our server
1 Lecture 02:59

Congrats on finishing this course! The link to the source code is below. Please fork it and create your own slash command. Looking forward to seeing what you create!

About the Instructor
Andrew Golightly
4.7 Average rating
5 Reviews
21 Students
1 Course
lead web developer

I've been working in IT for about 15 years now!! Crazy to think how that time has flown. My passion now-a-days is frontend development using React and Redux. 

Generally I love automating the processes people don't love, to give them the space to do what they do love to do. I also love taking new ideas and making them a digital reality!!