Guide: Creating Custom Slash Commands in Slack: Tips and Tutorial

Slack is a team productivity tool that comes with many configurations and services intended for customizationOne of the best of its customizable features to be Slash commandsSlash commands are essentially keywords that perform a specific action when you enter them as messages with a preceding slash symbol (/) in Slack.

Built-in Slash Commands

The current set of built-in Slash commands performs a series of predefined functions in Slack. For example, by entering the / away Slash command in the message entry box, you can change the status of your account, as you can see from the gif below.

Custom Slash Commands

You can also create custom Slash commands in Slack. Custom Slash commands allow developers to make secure HTTP requests to web applications or services, and receive relevant responses of those who are displayed as new Slack messages Suppose there is a web service that displays the current score of a football match in plain text. You can create a Slash statement for make a secure HTTP request to that web service and display the score received as reply text in the Slack message window.

Create a Slash statement

To create a Slash command, run the https: //[yourTeam].slack.com / apps / build / custom integration URL to the address bar of your browser, only replace the [yourTeam] placeholder with the name of your Slack team and click on the Slash Commands option.

On the next screen enter the keyword you want to use for your Slack Command (don’t use a space), then click Add Slash Command Integration buttonYou can edit this keyword later if you want.

You can do that on the next screen configure the settings for your Slash command. You have to URL of the web application you want to send your request to. You can also use a token value for the Slash command you just created, which you can use on your web server to validate the request sent by Slack.

Show the answer

Standard, are the answers to the requests of Slash commands displayed as plain text in the message box. If you prefer to show the messages in the Slack message format instead, the responses must be in valid JSON format Also, the response of a Slash command is standard visible only to the user who entered that command, and not others in the channel. This can only be changed if the response is a valid JSON with property “response_type” with value “in_channel”, then all users in the channel can see the answer. The property “text” contains the main text that is shown in the message. // Example JSON response {“response_type”: “in_channel”, “text”: “…”} As an example I will show an ASCII art chessboard in response to my custom / lets-play Slash command I created in the previous section, to demonstrate that you can show more complicated characters also in the response. You can read more at Slack’s message formatting in the Slack API docs. Below is a screenshot of it JSON response my example Slash command is displayed, or you can find the same JSON file on Github.

If you too want line breaks in your message use the n new line character in the value of the “text” property.

Run the command

Go to a channel or to the DM message window in Slack, and Enter the new Slash command in the message entry field. If you checked the box Show this command in the autocomplete list in your Slash command settings, you will see your command in the suggestion list while typing. If you had not done this and would like to update these settings now, you can return to the Slash command settings page and edit your configurations by clicking the little pencil icon to the right of the command. Below is a gif demo showing how my custom Slash command with the ASCII art chess boards in Slack.

Creating Custom Slash Commands in Slack: Tips and Tutorial: benefits

Faq

Final note

I hope you like the guide Creating Custom Slash Commands in Slack: Tips and Tutorial. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends. For our visitors: If you have any queries regards the Creating Custom Slash Commands in Slack: Tips and Tutorial, then please ask us through the comment section below or directly contact us. Education: This guide or tutorial is just for educational purposes. Misinformation: If you want to correct any misinformation about the guide “Creating Custom Slash Commands in Slack: Tips and Tutorial”, then kindly contact us. Want to add an alternate method: If anyone wants to add more methods to the guide Creating Custom Slash Commands in Slack: Tips and Tutorial, then kindly contact us. Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following us on Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off). Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.

Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 79Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 1Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 6Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 95Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 25Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 8Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 67Creating Custom Slash Commands in Slack  Tips and Tutorial 2021  2022  - 77