Plugins are defined by a manifest file and contain at least a server or web app component, or both.
The Plugin Starter Template is a starting point and illustrates the different components of a Mattermost plugin.
A more detailed example is the Demo Plugin, which showcases many of the features of plugins.
If you’d like to better understand how plugins work, see the contributor documentation on plugins.
The plugin manifest provides required metadata about the plugin, such as name and ID. It is defined in JSON or YAML. This is plugin.json
in both the sample and demo plugins.
See the manifest reference for more information.
The server component of a plugin is written in Go and runs as a subprocess of the Mattermost server process. The Go code extends the MattermostPlugin struct that contains an API and allows for the implementation of Hook methods that enable the plugin to interact with the Mattermost server.
The sample plugin implements this simply in plugin.go and the demo plugin splits the API and hook usage throughout multiple files.
Read more about the server-side of plugins here.
The web app component of a plugin is written in JavaScript with React and Redux. The plugin’s bundled JavaScript is included on the page and runs alongside the web app code as a PluginClass that has initialize and deinitialize methods available for implementation. The initialize function is passed through the registry which allows the plugin to register React components, actions and hooks to modify and interact with the Mattermost web app.
The sample plugin has a shell of an implemented PluginClass, while the demo plugin contains a more complete example.
The desktop app is a shim of the web app, meaning any plugin that works in the web app will also work in the desktop app.
Read more about the web app component of plugins here.
Currently there is no mobile app component of plugins but it is planned for the near term.