What is a slash command?

Slash commands can be used by your users to send a command to your app. For example,

  • The Appear.in app has a /video slash command which sends a notification to the Appear.in app to generate a video conference URL within that chat tab
  • The Todo app has a /todo slash command which provides the user a quick way to create to-dos from a conversation

Your app can use a slash command when you want to provide your user a CLI to perform some action. Note that the user can perform the same action using a chat tab button or widget. However power users may prefer using a slash command. A user can always see the entire list of slash commands available from various apps by typing "/" -

What is the format of a slash command?

A slash command comprises of a forward slash followed by the command name. Your slash command may also accept additional text.

Slash Command Format
/<commandName> <additional text>
  • commandName should be a string comprising of alphanumeric characters, or the symbols underscore or hyphen. It must begin with an alphanumeric character.
  • There should be no spaces between the slash and the command name.
  • There must be one or more spaces between the command name and the additional text that follows it.

How do I create a slash command?

  1. Go through Creating an App to setup your app in the developer dashboard.
  2. In the Advanced Info section, enable the slash command.

    Fill in the info below:

    Name of commandYesThe name of the slash command
    Short descriptionYesA short description of what the slash command does. This will be shown to the user against the slash command.
    Syntax hintNoA hint to the user on how to use the command
    Select action for Slash commandYesSelect an appropriate client action for this slash command.
  3. Save these changes, then follow the steps in app installation and install this app into your own Flock account.
  4. Once the app is installed, whenever a user enters a slash command, the event client.slashCommand will either be sent to the event listener URL or appended to the widget or browser URL, depending on the client action you selected in step 2.
  5. If you want to send a message back to the user upon receiving the event or opening the widget or browser URL, see Sending Messages.