- Configuration options
- Configure automatically
- Configure manually
- Connect your GitLab account to Mattermost
- Related topics
- Troubleshooting
Mattermost slash commands
You can use slash commands to run common GitLab operations, like creating an issue, from a Mattermost chat environment.
GitLab can also send events (such as issue created
) to Mattermost as part of the
separately configured Mattermost notifications.
For a list of available slash commands, see Slash commands.
Configuration options
GitLab provides different ways to configure Mattermost slash commands. For any of these options, you must have Mattermost 3.4 or later.
- Linux package installations: Mattermost is bundled with Linux package. To configure Mattermost for Linux package installations, read the Linux package Mattermost documentation.
- If Mattermost is installed on the same server as GitLab, use the automated configuration.
- For all other installations, use the manual configuration.
Configure automatically
If Mattermost is installed on the same server as GitLab, you can automatically configure Mattermost slash commands:
- On the left sidebar, select Search or go to and find your project.
- Select Settings > Integrations.
- Select Mattermost slash commands.
- Under Enable integration, ensure the Active checkbox is selected.
- Select Add to Mattermost, and select Save changes.
Configure manually
To manually configure slash commands in Mattermost, you must:
- Enable custom slash commands in Mattermost. This step is required only for self-compiled installations.
- Get configuration values from GitLab.
- Create a slash command in Mattermost.
- Provide the Mattermost token to GitLab.
Enable custom slash commands in Mattermost
To enable custom slash commands from the Mattermost administrator console:
- Sign in to Mattermost as a user with administrator privileges.
- Next to your username, select the Settings icon, and select System Console.
- Select Integration Management, and set these values to
TRUE
:- Enable Custom Slash Commands
- Enable integrations to override usernames
- Enable integrations to override profile picture icons
- Select Save, but do not close this browser tab. You need it in a later step.
Get configuration values from GitLab
To get configuration values from GitLab:
- In a different browser tab, sign in to GitLab as a user with administrator access.
- On the left sidebar, at the bottom, select Admin.
- Select Settings > Integrations.
- Select Mattermost slash commands. GitLab displays potential values for Mattermost settings.
- Copy the Request URL value. All other values are suggestions.
- Do not close this browser tab. You need it in a later step.
Create a slash command in Mattermost
To create a slash command in Mattermost:
- In the Mattermost browser tab, go to your team page.
- Select the Settings icon, and select Integrations.
- On the left sidebar, select Slash commands.
- Select Add Slash Command.
- Provide a Display Name and Description for your new command.
-
Provide a Command Trigger Word based on your application’s configuration:
-
If you intend to only connect one project to your Mattermost team, use
/gitlab
for your trigger word. -
If you intend to connect multiple projects, use a trigger word that relates
to your project, such as
/project-name
or/gitlab-project-name
.
-
If you intend to only connect one project to your Mattermost team, use
- For Request URL, paste the value you copied from GitLab.
- For all other values, you may use the suggestions from GitLab or your preferred values.
- Copy the Token value, and select Done.
Provide the Mattermost token to GitLab
Creating a slash command in Mattermost generates a token you must provide to GitLab:
- In the GitLab browser tab, select the Active checkbox.
- In the Token text box, paste the token you copied from Mattermost.
- Select Save changes.
Your slash command can now communicate with your GitLab project.
Connect your GitLab account to Mattermost
Prerequisites:
- To run slash commands, you must have permission to perform the action in the GitLab project.
To interact with GitLab using Mattermost slash commands:
- In a Mattermost chat environment, run your new slash command.
- Select connect your GitLab account to authorize access.
You can see all authorized chat accounts in your Mattermost profile page under Chat.
Related topics
Troubleshooting
When a Mattermost slash command does not trigger an event in GitLab:
- Ensure you’re using a public channel. Mattermost webhooks do not have access to private channels.
- If you require a private channel, edit the webhook channel, and select a private one. All events are sent to the specified channel.