Mattermost APIs

With Mattermost you have complete access to the server’s Web Service APIs, along with language specific drivers (the same used by the web, desktop and mobile experiences), plus Slack-compatible webhooks and Slash commands for creating quick integrations.

There’s a vibrant community developing open source apps on Mattermost and you can start your work based on their code, or use a pre-made sample provided by the Mattermost team.

Slack Compatible Webhooks & Slash Commands

API and Drivers

Building API Integrations

Slack-compatible Webhooks

To offer an alternative to propreitary SaaS services, Mattermost focuses on being “Slack-compatible, but not Slack limited”. That means providing support for developers of Slack applications to easily extend their apps to Mattermost, as well as support and capabilities beyond what Slack offers.

Incoming Webhooks

Incoming webhooks allow external applications to post messages into Mattermost channels and private groups by sending a JSON payload via HTTP POST request to a secret Mattermost URL generated specifically for each application.

In addition to supporting Slack’s incoming webhook formatting, Mattermost webhooks offer full support of industry-standard markdown formatting, including headings, tables and in-line images.

Outgoing Webhooks

Outgoing webhooks allow external applications to receive webhook events from events happening within Mattermost channels via JSON payloads via HTTP POST requests sent to incoming webhook URLs defined by your applications.

Over time, Mattermost outgoing webhooks will support not only Slack applications using a compatible format, but also offer optional events and triggers beyond Slack’s feature set.

Slash Commands

Slash commands, like outgoing webhooks, allow users to interact with external applications right from within Mattermost. The user will enter a / followed by a command, and optionally some arguments, then an HTTP request will be sent to an external application. What occurs next is decided by how the application responds to the HTTP request.

Mattermost Web Service API

Mattermost offers a Web Service API accessible by Mattermost Drivers, listed below. See:

Mattermost Drivers

Mattermost drivers offer access to the Mattermost web service API in different languages and frameworks.

ReactJS Javascript Driver

web-client.jsx - This Javascript driver connects with the ReactJS components of Mattermost. The web client does the vast majority of its work by connecting to a RESTful JSON web service. There is a very small amount of processing for error checking and set up that happens on the web server.

Golang Driver

client.go - This is a RESTful driver connecting with the Golang-based webservice of Mattermost and is used by unit tests.

  • See GoDocs for documentation on the Golang Driver.

Building API Integrations

If you’re building a deep integration with Mattermost, for example a mobile native client, and there is a driver available to support the programming language you are using, it’s best to use the driver available to access the Mattermost Web Service APIs.

If no driver is available for the programming language of your choice, you can view the Golang Driver source code to understand how it exercises the Web Service API. You can also learn more by reviewing open source projects that use the Web Service API, like matterircd.

There are a wide range of installation guides for setting up your own Mattermost server on which to develop and test your integrations.

Mattermost Golang Bot Sample (Driver Example)

Mattermost provides a Golang Bot Sample to demonstration how Mattermost works with the Golang driver and the APIs.

Community Apps and Integrations

The Mattermost community has shared back dozens of open source integrations showing how to use webhooks, drivers and APIs in different ways. See the Community Applications Directory to learn more.