Edit on GitHub

Mattermost Server plugins

Server plugins are subprocesses invoked by the server that communicate with Mattermost using remote procedure calls (RPC).

Looking for a quick start? See our “Hello, world!” tutorial.

Want the Server SDK reference doc? Find it here.

Features 

RPC API 

Use the RPC API to execute create, read, update and delete (CRUD) operations on server data models.

For example, your plugin can consume events from a third-party webhook and create corresponding posts in Mattermost, without having to host your code outside Mattermost.

Hooks 

Register for hooks and get alerted when certain events occur.

For example, consume the OnConfigurationChange hook to respond to server configuration changes, or the MessageHasBeenPosted hook to respond to posts.

REST API 

Implement the ServeHTTP hook to extend the existing Mattermost REST API.

Plugins with both a web app and server component can leverage this REST API to exchange data. Alternatively, expose your REST API to services and developers connecting from outside Mattermost.

How it works 

When starting a plugin, the server consults the plugin’s manifest to determine if a server component was included. If found, the server launches a new process using the executable included with the plugin.

The server will trigger the OnActivate hook if the plugin is successfully started, allowing you to perform startup events. If the plugin is disabled, the server will trigger the OnDeactivate hook. While running, the server plugin can consume hook events, make API calls, launch threads or subprocesses of its own, interact with third-party services or do anything else a regular program can do.

High availability 

Considerations for plugins in a high availability configuration are documented here: High Availability

Best practices 

Some best practices for working with the server component of a plugin are documented here: Best Practices

Debug Server plugins 

Guidelines for debugging the server-side of plugins are documented here: Debug Server plugins

Did you find what you were looking for?

Thank you! We appreciate your feedback.
×

Tell us more

Your feedback helps us improve the Mattermost developer documentation.

Have a feature request? Share it here.

Having issues? Join our Community server.