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 ascommandwhen 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
List the slash commands to see what is available, or get one command's details.
Execute the command with the target
roomIdand any parameters.
Work with command previews
Get the command's preview data for the typed parameters — for example, GIF suggestions for
/giphy.Execute the chosen preview item to post it to the room.
Conventions
Commands execute in a room: pass the
roomIdwhere 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, andsortquery parameters.