2020-10-24 23:57:45 +05:30
---
2022-11-25 23:54:43 +05:30
stage: Manage
2021-10-27 15:23:28 +05:30
group: Integrations
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-10-24 23:57:45 +05:30
---
2021-04-17 20:07:23 +05:30
# Mattermost slash commands **(FREE)**
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
You can use slash commands to run common GitLab operations, like creating an issue,
from a [Mattermost ](https://mattermost.com/ ) chat environment.
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
GitLab can also send events (such as `issue created` ) to Mattermost as part of the
2022-10-11 01:57:18 +05:30
separately configured [Mattermost notifications ](mattermost.md ).
2019-09-30 21:07:59 +05:30
2022-10-11 01:57:18 +05:30
## Configuration options
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
GitLab provides different ways to configure Mattermost slash commands. For any of these options,
you must have Mattermost [3.4 or later ](https://mattermost.com/blog/category/platform/releases/ ).
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
- **Omnibus GitLab installations**: Mattermost is bundled with
2022-10-11 01:57:18 +05:30
[Omnibus GitLab ](https://docs.gitlab.com/omnibus/ ). To configure Mattermost for Omnibus GitLab,
read the [Omnibus GitLab Mattermost documentation ](../../../integration/mattermost/index.md ).
2021-04-17 20:07:23 +05:30
- **If Mattermost is installed on the same server as GitLab**, use the
2022-10-11 01:57:18 +05:30
[automated configuration ](#configure-automatically ).
- **For all other installations**, use the [manual configuration ](#configure-manually ).
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
## Configure automatically
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
If Mattermost is installed on the same server as GitLab,
you can automatically configure Mattermost slash commands:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Settings > Integrations** .
1. In **Add an integration** , select **Mattermost slash commands** .
1. In **Enable integration** , ensure the **Active** checkbox is selected.
1. Select **Add to Mattermost** , and select **Save changes** .
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
## Configure manually
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
To manually configure slash commands in Mattermost, you must:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
1. [Enable custom slash commands in Mattermost ](#enable-custom-slash-commands-in-mattermost ).
(This step is required only for installations from source.)
1. [Get configuration values from GitLab ](#get-configuration-values-from-gitlab ).
1. [Create a slash command in Mattermost ](#create-a-slash-command-in-mattermost ).
1. [Provide the Mattermost token to GitLab ](#provide-the-mattermost-token-to-gitlab ).
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
### Enable custom slash commands in Mattermost
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
To enable custom slash commands from the Mattermost administrator console:
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
1. Sign in to Mattermost as a user with administrator privileges.
2022-05-07 20:08:51 +05:30
1. Next to your username, select the ** {ellipsis_v}** **Settings** icon, and
2021-04-17 20:07:23 +05:30
select **System Console** .
1. 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**
2022-10-11 01:57:18 +05:30
1. Select **Save** , but do not close this browser tab. You need it in
2021-04-17 20:07:23 +05:30
a later step.
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
### Get configuration values from GitLab
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
To get configuration values from GitLab:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
1. In a different browser tab, sign in to
2022-04-04 11:22:00 +05:30
GitLab as a user with administrator access.
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Admin** .
1. On the left sidebar, select **Settings > Integrations** .
1. Select **Mattermost slash commands** . GitLab displays potential values for Mattermost settings.
1. Copy the **Request URL** value. All other values are suggestions.
1. Do not close this browser tab. You need it in a later step.
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
### Create a slash command in Mattermost
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
To create a slash command in Mattermost:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
1. [In the Mattermost browser tab ](#enable-custom-slash-commands-in-mattermost ),
go to your team page.
2022-05-07 20:08:51 +05:30
1. Select the ** {ellipsis_v}** **Settings** icon, and select **Integrations** .
2022-10-11 01:57:18 +05:30
1. On the left sidebar, select **Slash commands** .
1. Select **Add Slash Command** .
2021-04-17 20:07:23 +05:30
1. Provide a **Display Name** and **Description** for your new command.
2022-10-11 01:57:18 +05:30
1. Provide a **Command Trigger Word** based on your application's configuration:
2021-04-17 20:07:23 +05:30
2022-10-11 01:57:18 +05:30
- **If you intend to only connect one project to your Mattermost team**, use
2021-04-17 20:07:23 +05:30
`/gitlab` for your trigger word.
2022-10-11 01:57:18 +05:30
- **If you intend to connect multiple projects**, use a trigger word that relates
2021-04-17 20:07:23 +05:30
to your project, such as `/project-name` or `/gitlab-project-name` .
2022-10-11 01:57:18 +05:30
1. For **Request URL** , [paste the value you copied from GitLab ](#get-configuration-values-from-gitlab ).
1. For all other values, you may use the suggestions from GitLab or your
2021-04-17 20:07:23 +05:30
preferred values.
2022-10-11 01:57:18 +05:30
1. Copy the **Token** value, and select **Done** .
2021-04-17 20:07:23 +05:30
### Provide the Mattermost token to GitLab
2022-10-11 01:57:18 +05:30
Creating a slash command in Mattermost generates a token you must
2021-04-17 20:07:23 +05:30
provide to GitLab:
2022-10-11 01:57:18 +05:30
1. [In the GitLab browser tab ](#get-configuration-values-from-gitlab ),
select the **Active** checkbox.
1. In the **Token** text box, [paste the token you copied from Mattermost ](#create-a-slash-command-in-mattermost ).
1. Select **Save changes** .
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
Your slash command can now communicate with your GitLab project.
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
## Connect your GitLab account to Mattermost
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
Prerequisite:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
- To run [slash commands ](#available-slash-commands ), you must have
[permission ](../../permissions.md#project-members-permissions ) to
perform the action in the GitLab project.
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
To interact with GitLab using Mattermost slash commands:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
1. In a Mattermost chat environment, run your new slash command.
1. Select **connect your GitLab account** to authorize access.
You can see all authorized chat accounts in your Mattermost profile page under **Chat** .
2017-08-17 22:00:37 +05:30
## Available slash commands
2021-04-17 20:07:23 +05:30
The available slash commands for Mattermost are:
2017-08-17 22:00:37 +05:30
| Command | Description | Example |
| ------- | ----------- | ------- |
2022-10-11 01:57:18 +05:30
| `/<trigger> issue new <title>` < kbd > Shift</ kbd > +< kbd > Enter</ kbd > `<description>` | Create a new issue in the project that `<trigger>` is tied to. `<description>` is optional. | `/gitlab issue new We need to change the homepage` |
| `/<trigger> issue show <issue-number>` | Show the issue with ID `<issue-number>` from the project that `<trigger>` is tied to. | `/gitlab issue show 42` |
| `/<trigger> deploy <environment> to <environment>` | Start the CI/CD job that deploys from one environment to another (for example, `staging` to `production` ). CI/CD must be [properly configured ](../../../ci/yaml/index.md ). | `/gitlab deploy staging to production` |
| `/<trigger> help` | View a list of available slash commands. | `/gitlab help` |
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
## Related topics
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
- [Mattermost slash commands ](https://developers.mattermost.com/integrate/slash-commands/ )
- [Omnibus GitLab Mattermost ](../../../integration/mattermost/index.md )
2017-08-17 22:00:37 +05:30
2020-05-24 23:13:21 +05:30
## Troubleshooting
2022-10-11 01:57:18 +05:30
When a Mattermost slash command does not trigger an event in GitLab:
2017-08-17 22:00:37 +05:30
2022-10-11 01:57:18 +05:30
- 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.