Slash Commands¶
Execute actions with simple commands inside Mattermost. Learn how to run Mattermost slash commands.
Built-in slash commands¶
Technical complexity: No-code
These out-of-the-box commands enable command line interaction with users, channels, and conversations. Examples of pre-built slash commands include /invite
to add teammates to a channel, /header
to set a channel description, or /call
to start or join a call in a channel.
Additionally, you can interact with the data model programmatically using API endpoints. Responses are posted as the user who invoked the command, with possible username/icon overrides.
Learn more about built-in slash commands available in Mattermost.
Custom slash commands¶
Technical complexity: Low-code
Slash commands are similar to an outgoing webhooks, but instead of listening for keywords in a channel they are triggered by users explicitly typing a preconfigured command. Using slash commands is similar to using a command line within a channel. This means if you type in a slash command it will execute without posting a message, whereas an outgoing webhook is only triggered by posted messages. The external service then processes the request and can return a response, such as plain text, rich message content, interactive buttons or forms, directly into the channel.
Mattermost’s slash command format is Slack compatible, so you can easily migrate your commands from Slack.
Learn more about building custom slash commands.
Example Use Cases¶
Here are some example use cases for slash commands in Mattermost:
Project management
Typing /jira create
opens an interactive dialog where you can file a new Jira issue directly from Mattermost, including fields like summary, description, and priority.
Incident response
Using /pagerduty trigger
can open a form to start a new incident, notify on-call responders, and post details back into the channel so the team can coordinate.
Knowledge retrieval
A command like /docs search authentication
queries your documentation system and returns a list of relevant articles as interactive message attachments with links.