Mattermost 5.2 will include major overhauls to the plugin system. Over the last six months of plugins being in beta, we’ve received a lot of great feedback from our community and customers building Mattermost plugins, as well as from our core team. We’ve taken this experience and feedback and used it to enhance our plugin system. This brings us a step closer to moving plugins out of beta and into a full stable release.
Switching to HashiCorp’s go-plugin
The biggest change to the plugin system is that the server-side is now built on top of HashiCorp’s production-proven go-plugin. We made this decision because the system we built ourselves was very similar to go-plugin and with go-plugin, we get the insurance of stability from a system that has been used in production for years. We also get slew of features that will make Mattermost plugins even better over time, such as gRPC support that would allow server-side plugins to be written in almost any programming language.
Server-side plugin hooks have had a Context added to them as the first parameter. Right now the Context is blank. But in the future, we will be adding useful context-specific information, such as request IDs and other tracing/logging information.
We’ve also added many more hooks, such as allowing plugins to intercept/reject post creation and triggering events when a user joins or leaves channels/teams. See the godoc for all available hooks.
Extensibility Over Replacement
One of the big features of the initial implementation of the client-side plugin system was to allow overriding or replacing existing Mattermost UI components with custom ones. This worked well when one large plugin installed at a time but quickly fell down when multiple plugins wanted to override the same component. To address this the new plugin system for the web and desktop apps, we focused on providing extensibility over replacement.
Now, the focus is less on overriding Mattermost UI components and more on allowing one or more plugins to extend them by inserting custom components into certain pluggable locations. This makes it feasible for many plugins to be installed and work together, instead of fighting over which plugin gets to override a single component.
More New Features
In addition to the larger changes above, the new plugin system in Mattermost 5.2 will also have some other cool new features:
- Enhanced plugin logging - log like you normally would to stdout or stderr, or use the new logging API, and either way it will get captured in the Mattermost structured server logs
- Custom WebSocket events - publish your own WebSocket events from the server-side of your plugin and add function handlers for those events on your client-side
- Expanded APIs - new APIs give more power and options both server-side and client-side (thanks to dschalla for the help here!)
- CLI management - fully manage plugins from the Mattermost command-line interface (thanks to santos22 for the help here!)
All these great changes will require changes to any plugins built for pre-5.2 versions of Mattermost. See our migration guide for steps on how to update your plugins.
Join us for a plugin hackathon during August 16th and 17th, with presentations happening on August 20th!
Huge shout out to our community for all the feedback and help with plugins. Extra thanks to santos22 for adding CLI commands and dschalla for adding server-side hooks and APIs, as well as ThiefMaster, Bee, Hanzei and everyone else who has been helping in the ~Developer Toolkit channel.
For the full documentation on plugins, see developers.mattermost.com/extend/plugins.