Slack Slash Commands for Everyone + 10 Free APIs

Slack_IconYou might be new to the whole idea of “bots” or acronyms like REST, API, HTTP, and cURL. And you probably don’t know how to code your way out of a wet paper bag. But this doesn’t mean you cannot or should not get your hands dirty and have a little fun making a customized little tool for yourself and your team. This is a quick and easy “Hello World” tutorial for creating your own Slack slash commands that anybody, no matter how technically savvy, can follow.

Custom slash commands for Slack allow you to access information from across the internet without leaving your favorite messaging tool.

Custom slash commands for Slack allow you to access information from across the internet without leaving your favorite messaging tool. In essence, slash commands allow your Slack app act as a Web browser, but instead of returning and displaying a fully rendered HTML web page, Slack displays a bit of text information from a slash command “bot.” It’s as simple as that.

How Custom Slash Commands Work

Slash commands work similar to the way your web browser retrieves an HTML web page found at the URL in the address bar. The difference is that the Slack app retrieves the plaintext information found at the URL you set in your custom slash command. In both cases, browser and the Slack app are sending an HTTP “GET” request to another server. Slack can also send a POST request to send information to a given location, but this tutorial is meant to be quick and easy for non-techies, so we are going to stick to retrieving plain text content.

So you are wondering, where can I get this text content if I can’t program a server to return something? Luckily there are plenty of plaintext APIs that return useful, interesting, and sometimes silly information. Check them out by skipping to the list of plaintext APIs below. Choose one of the APIs or find another one that you want to use, then test the API URL by pasting it into you

Choose one of the APIs or find another one that you want to use. Then test the API by pasting the URL into your browser. If the browser displays only text without any formatted HTML, you’re ready to make your slash command!

Create Your Custom Slash Command

Let’s get started! First, go to: {{yourSlackTeam}}.slack.com/apps/manage/custom-integrations and select Slash Commands. On the next page, click Add Configuration. Then just follow the next three steps.create a slack slash command

  1. Setup Your Request

    Once you have found the text API that you want to use in your slash command, enter the Command name, the URL of the API request, and leave the Method as “GET.”  For this demo, we are using the Lorem Ipsum generator API found here: http://loripsum.net/api/plaintext. Click the link to see what it provides.

    name your slash command

  2. Customize the Appearance

    Here is the fun part. You get to decide what your slash command’s response looks like. Choose a cute name and upload an image or choose from any one of the many Slack emojis.
    customize the slack bot appearance

  3. Help Users Use It

    For the Description, provide a short explanation of what your slash command will return to the user.
    describe your slash command

  4. Try it out!

    Type in your slash command or type part of the command and use the tab-complete to fill in the command. Hit enter and boom! You have your first working slash command.
    use your slack slach command

10 Free Plain Text APIs for Custom Slash Commands

Now that you know how to make your own slash command integration, here are a few API’s to play around with. If you made one that you want to share or found one that you like, please leave a link in the comment section.

  1. Lorem Ipsum: Just like the one in the demo, get all the Lorem Ipsum text you could ever ask for at http://loripsum.net/api/plaintext
  2. Check Your IP Address: If you move around a lot and you need to know your IP address, just call this API: https://api.ipify.org
  3. Get a Currency Exchange Rate: With a free API key, you can get more API calls than you will ever need. Here is the URL for US Dollars to Hong Kong Dollars: https://www.exchangerate-api.com/USD/HKD?k=yourAPIKey
  4. History Trivia: Get a trivia fact about a random year in world history: http://numbersapi.com/random/year or a random date: http://numbersapi.com/random/date
  5. Random Number Trivia: Get a trivia fact about a random number. http://numbersapi.com/random/trivia
  6. Chuck Norris Jokes: Ok, this one returns JSON, not plain text, but it’s short enough to parse it visually quite easy. Plus its just too funny to pass up. http://api.icndb.com/jokes/random
  7. Profound Quotes: Sometimes is just nice to hear some Nietzsche and then some Twain. Chat with the greats: http://api.forismatic.com/api/1.0/?method=getQuote&lang=en
  8. Yes/No Decision Making: Can’t decide whether you should do something? There’s an API for that. This is another JSON API, but since the response is so short, it is still easy to read. https://yesno.wtf/api
  9. Magic 8 Ball Decision Making: For the tough questions, you need a little magic. This one also returns human-friendly JSON, and can only answer one question per Slack command, so make it a good one! https://8ball.delegator.com/magic/JSON/Will%20I%20…%3F
  10. When does Donald Trump Leave Office? If you read the news in America, you may find yourself wondering this. Now Slack can answer this question at a moment’s notice. Here’s the AWS Lambda URL.

Have fun! And remember, “with great power comes great responsibility.

Leave a Comment

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