Introduction to Slash Commands

Prev Next

Slash commands are shortcuts that run an action in a room, such as /invite or /topic. The Commands API lets an integration discover which commands a workspace offers and execute them programmatically, exactly as if a user had typed them into the message box.

The command object

Command endpoints return command objects. A trimmed example from List Slash Commands:

{
  "commands": [
    {
      "command": "topic",
      "params": "Slash_Topic_Params",
      "description": "Slash_Topic_Description",
      "clientOnly": false
    },
    {
      "command": "invite",
      "clientOnly": false
    }
  ],
  "offset": 0,
  "count": 22,
  "total": 22,
  "success": true
}

Fields you use most often:

  • command: The command name, without the leading slash. Pass it as command when executing.

  • params: The parameters the command accepts, when it takes any.

  • clientOnly: Whether the command runs only in the client. Client-only commands cannot be executed through the API.

Common workflows

Run a slash command from an integration

  1. List the slash commands to see what is available, or get one command's details.

  2. Execute the command with the target roomId and any parameters.

Work with command previews

  1. Get the command's preview data for the typed parameters — for example, GIF suggestions for /giphy.

  2. Execute the chosen preview item to post it to the room.

Conventions

  • Commands execute in a room: pass the roomId where the command should run, and the result appears in that room as it would for a typing user.

  • The available commands vary by workspace — installed apps and integrations register their own commands, so list them rather than hard-coding names.

  • List Slash Commands supports count, offset, and sort query parameters.