Mattermost supports plugins that offer powerful features for extending and deeply integrating with both the server and web/desktop apps.
This document covers the plugin infrastructure and how to contribute to it.
Looking to build a plugin? Then you want the plugin author documentation.
The manifest tells Mattermost what the plugin is and provides a set of metadata used by the server to install and run the plugin. Please see the manifest reference for more information. Manifests may be defined in JSON or YAML.
The server binary is a compiled Go program that extends the MattermostPlugin struct of the plugin package. When enabled, the plugin’s server binary is started as a process by the Mattermost server. Plugin developers then have access to interact with the Mattermost server over RPC through the plugin API and Hooks. The server-side of plugins is built using the go-plugin library from Hashicorp. More information is available in the server side of the plugin author documentation.
All these different components of a plugin are compressed into a .tar.gz bundle. Installing a plugin is the process of uploading this bundle to the Mattermost server (via the UI, REST API or CLI). The server then unpacks the bundle, performs some validation and extracts it into the configured directory for storing installed plugins. Installed plugins are not yet running. To start a plugin it must be enabled (again via the UI, REST API or CLI). Once it is enabled, the server will then start the server process and prepare the web app bundle for serving to the client. Plugin settings, configuration and enabled/disabled status are managed by the Mattermost
config.json using a PluginSettings struct.
Check out the `plugin` package and the plugin_* files in the `app` package for the code, and mattermost-plugin-demo for an example plugin. To start developing your own plugin, please follow the instructions here.
To add a plugin API you need to add the signature of your new method to the API interface. You then need to implement the API in the plugin_api.go of the
app package. Finally, you need to run
make pluginapi to generate the RPC glue code needed for your new API and
make plugin-mocks to generate the mocks used for plugin testing.
That’s it! Submit your pull request.
If you have any questions, feel free to ask in the Toolkit channel of our Mattermost community instance.