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.
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.
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.
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.
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.
Considerations for plugins in a high availability configuration are documented here: High Availability
Some best practices for working with the server component of a plugin are documented here: Best Practices
Guidelines for debugging the server-side of plugins are documented here: Debug Server plugins