Mattermost Slack



To import a theme, go to Preferences Sidebar Theme from within Slack, open the custom theme option, copy the theme color vector and then paste it into the Input Slack Theme input box in Mattermost. Any theme settings that are not customizable in Slack will default to the “Mattermost”. Mattermost Enterprise Edition versus Slack Plus. Data sovereignty – Ability to control the country in which your data is stored and the laws under which it may be legally accessed. Yes, English, German, French, Japanese, Spanish, Portugese. Coming August 2016: Chinese. Monthly – Mattermost releases new improvements on the 16th of the month.

Tool chest

Mattermost is an open source self-hosted Slack-alternative. Mattermost is: Slack-compatible not Slack-limited '96 Mattermost features rival Slack features and support a superset of Slack'92s incoming and outgoing webhook integrations including compatibility with existing Slack integrations. From your existing Slack teams you can import users public channel history and even theme setting colors into Mattermost. Mobile and desktop apps in addition to web '96 Use Mattermost from your iOS or Android phones and tablets or with installed apps on Windows Linux and Mac. Easy to deploy manage and upgrade '96 Mattermost runs as Linux binary Docker image and many other forms. Try Mattermost with a one-line Docker install andmany install guides are available. Improvements ship monthly. Supported by a vibrant community '96 Use Mattermost with dozens of community integrations and applications including Jira IRC XMPP Hubot Giphy Jenkins GitLab Trac Redmine SVN RSS/Atom and many others. Build and share your own apps usingMattermost APIs and drivers.

Slack is the undisputed champion of the workplace group chat world. But HipChat and Mattermost have their own fans, as well. HipChat is frequently called “developer-friendly” and “IRC-like.”. Mattermost is open source and deployed on-premise, differentiating it from its competitors. Mattermost Incident Management. Deploy Mattermost as a DevOps command center. Mattermost is an open source, self-hosted Slack-alternative As an alternative to proprietary SaaS messaging, Mattermost brings all your team communication into one place, making it searchable and accessible anywhere. It’s written in Golang and React and runs as a production-ready Linux binary under an MIT license with either MySQL or Postgres.

Edit on GitHub

Slash commands are messages that begin with / and trigger an HTTP request to a web service that can in turn post one or more messages in response.

Unlike outgoing webhooks, slash commands work in private channels and direct messages in addition to public channels, and can be configured to auto-complete when typing. Note that while Mattermost includes a number of built-in slash commands, this document concerns itself only with the slash commands that can be configured as custom integrations.

Basic Usage

Follow the admin guide to create a slash command.

After creating the slash command, you’ll be given a token. Treat this as a secret. Anyone who has this token will be able to mimic requests to your application.

If you configured a slash command with a trigger word of test, a request URL of http://example.com/slash-command and a POST request method, and someone posts the message

to your Town Square channel, your endpoint will receive:

As evidenced by the Content-Type, this is a typical form-urlencoded payload similar to what you would receive from a <form method='POST'> element on an HTML web page.

Matter most slacks

Upon receiving one of these requests, your integration should immediately confirm that the token provided in the request body matches the one given to you after the slash command was created. If it does not match, it is strongly recommended that you reject the request. This ensures that the request actually came from Mattermost.

Once the request is verified, you can emit a message in the channel where the slash command was invoked by responding with a 200 status code and including a response body as follows:

Be sure to set the Content-Type to application/json otherwise your response will be displayed as plaintext.

Delayed and multiple responses

Mattermost versus slack

You can use the response_url parameter to supply multiple responses or a delayed response to a slash command. Response URLs can be used to send five additional messages within a 30-minute time period from the original command invocation.

Delayed responses are useful when the action takes more than three seconds to perform. For instance:

  • Retrieval of data from external third-party services, where the response time may take longer than three seconds.
  • Report generation, batch processing or other long-running processes that take longer than three seconds to respond.

Any requests that are made to the response URL should either be a plain text or JSON-encoded body. The JSON-encoded message supports both Markdown formatting and message attachments.

Parameters

Slash command responses support more than just the text field. Here is a full list of supported parameters.

ParameterDescriptionRequired
textMarkdown-formatted message to display in the post.If attachments is not set, yes
response_typeSet to blank or ephemeral to reply with a message that only the user can see.
Set to in_channel to create a regular message.
Defaults to ephemeral.
No
usernameOverrides the username the message posts as.
Defaults to the username set during webhook creation or the webhook creator’s username if the former was not set.
Must be enabled in the configuration.
No
channel_idOverrides the channel to which the message gets posted.
Defaults to the channel in which the command was issued.
No
icon_urlOverrides the profile picture the message posts with.
Defaults to the URL set during webhook creation or the webhook creator’s profile picture if the former was not set.
Must be enabled in the configuration.
No
goto_locationA URL to redirect the user to. Supports many protocols, including http://, https://, ftp://, ssh:// and mailto://.No
attachmentsMessage attachments used for richer formatting options.If text is not set, yes
typeSets the post type, mainly for use by plugins.
If not blank, must begin with custom_. Passing attachments will ignore this field and set the type to slack_attachment.
No
extra_responsesAn array of responses used to send more than one post in your response. Each item in this array takes the shape of its own command response, so it can include any of the other parameters listed here, except goto_location and extra_responses itself. Available in Mattermost v5.6 and later.No
skip_slack_parsingIf set to true Mattermost will skip the Slack-compatibility handling. Useful if the post contains text or code which is incorrectly handled by the Slack-compatibility logic. Available in Mattermost v5.20 and later.No
propsSets the post props, a JSON property bag for storing extra or meta data on the post.
Mainly used by other integrations accessing posts through the REST API.
The following keys are reserved: from_webhook, override_username, override_icon_url and attachments.
No

An example request using some more parameters would look like this:

FAQ

How do I debug slash commands?

To debug slash commands in System Console > Logs, set System Console > Logging > Enable Webhook Debugging to true and set System Console > Logging > Console Log Level to DEBUG.

How do I send multiple responses from a slash command.

Slack

You can send multiple responses with an extra_responses parameter as follows.

What if my slash command takes time to build a response?

Reply immediately with an ephemeral message to confirm response of the command, and then use the response_url to send up to five additional messages within a 30-minute time period from the original command invocation.

Why does my slash command fail to connect to localhost?

Mattermost Export Slack

By default, Mattermost prohibits outgoing connections that resolve to certain common IP ranges, including the loopback (127.0.0.0/8) and various private-use subnets.

During development, you may override this behaviour by setting ServiceSettings.AllowedUntrustedInternalConnections to '127.0.0.0/8' in your config.json or via the System Console’s Advanced > Developer page. See the admin guide’s notes for more details.

Should I configure my slash command to use POST or GET?

Best practice suggests using GET only if a request is considered idempotent. This means that the request can be repeated safely and can be expected to return the same response for a given input. Some servers hosting your slash command may also impose a limit to the amount of data passed through the query string of a GET request.

Ultimately, however, the choice is yours. If in doubt, configure your slash command to use a POST request.

Note that slash commands configured to use a GET request were broken prior to Mattermost release 5.0.0. The payload was incorrectly encoded in the body of the GET request instead of in the query string. While it was still technically possible to extract the payload, this was non-standard and broke some development stacks.

Why does my slash command always fail with returned an empty response?

If you are emitting the Content-Type: application/json header, your body must be valid JSON. Any JSON decoding failure will result in this error message.

Mattermost Vs Teams

Also, you must provide a response_type. Mattermost does not assume a default if this field is missing.

Why does my slash command print the JSON data instead of formatting it?

Slack

Ensure you are emitting the Content-Type: application/json header, otherwise your body will be treated as plain text and posted as such.

Are slash commands Slack-compatible?

See the admin guide’s notes on Slack compatibility.

How do I use Bot Accounts to reply to slash commands?

If you are developing an integration
  • Set up a Personal Access Token for the Bot Account you want to reply with.
  • Use the REST API to create a post with the Access Token.
Matter most slacks
If you are developing a plugin

Use CreatePost plugin API. Make sure to set the UserId of the post to the UserId of the Bot Account. If you want to create an ephemeral post, use SendEphemeralPost plugin API instead.