The plugin serves as a starting point for writing a Mattermost plugin

Plugin Starter Template CircleCI branch

This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository.

To learn more about plugins, see our plugin documentation.

Getting Started

Use GitHub's template feature to make a copy of this repository by clicking the "Use this template" button.

Alternatively shallow clone the repository matching your plugin name:

git clone --depth 1 https://github.com/mattermost/mattermost-plugin-starter-template com.example.my-plugin

Note that this project uses Go modules. Be sure to locate the project outside of $GOPATH.

Edit the following files:

  1. plugin.json with your id, name, and description:
{
    "id": "com.example.my-plugin",
    "name": "My Plugin",
    "description": "A plugin to enhance Mattermost."
}
  1. go.mod with your Go module path, following the <hosting-site>/<repository>/<module> convention:
module github.com/example/my-plugin
  1. .golangci.yml with your Go module path:
linters-settings:
  # [...]
  goimports:
    local-prefixes: github.com/example/my-plugin

Build your plugin:

make

This will produce a single plugin file (with support for multiple architectures) for upload to your Mattermost server:

dist/com.example.my-plugin.tar.gz

Development

To avoid having to manually install your plugin, build and deploy your plugin using one of the following options.

Deploying with Local Mode

If your Mattermost server is running locally, you can enable local mode to streamline deploying your plugin. Edit your server configuration as follows:

{
    "ServiceSettings": {
        ...
        "EnableLocalMode": true,
        "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket"
    }
}

and then deploy your plugin:

make deploy

You may also customize the Unix socket path:

export MM_LOCALSOCKETPATH=/var/tmp/alternate_local.socket
make deploy

If developing a plugin with a webapp, watch for changes and deploy those automatically:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make watch

Deploying with credentials

Alternatively, you can authenticate with the server's API with credentials:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_USERNAME=admin
export MM_ADMIN_PASSWORD=password
make deploy

or with a personal access token:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make deploy

Q&A

How do I make a server-only or web app-only plugin?

Simply delete the server or webapp folders and remove the corresponding sections from plugin.json. The build scripts will skip the missing portions automatically.

How do I include assets in the plugin bundle?

Place them into the assets directory. To use an asset at runtime, build the path to your asset and open as a regular file:

bundlePath, err := p.API.GetBundlePath()
if err != nil {
    return errors.Wrap(err, "failed to get bundle path")
}

profileImage, err := ioutil.ReadFile(filepath.Join(bundlePath, "assets", "profile_image.png"))
if err != nil {
    return errors.Wrap(err, "failed to read profile image")
}

if appErr := p.API.SetProfileImage(userID, profileImage); appErr != nil {
    return errors.Wrap(err, "failed to set profile image")
}

How do I build the plugin with unminified JavaScript?

Setting the MM_DEBUG environment variable will invoke the debug builds. The simplist way to do this is to simply include this variable in your calls to make (e.g. make dist MM_DEBUG=1).

Similar Resources

Go library for writing standalone Map/Reduce jobs or for use with Hadoop's streaming protocol

dmrgo is a Go library for writing map/reduce jobs. It can be used with Hadoop's streaming protocol, but also includes a standalone map/reduce impleme

Nov 27, 2022

Package for writing Nagios/Icinga/et cetera plugins in Go (golang)

nagiosplugin Package for writing Nagios/Icinga/et cetera plugins in Go (golang). Documentation See http://godoc.org/github.com/olorin/nagiosplugin. Us

Aug 30, 2022

webrpc is a schema-driven approach to writing backend services for modern Web apps and networks

webrpc is a schema-driven approach to writing backend services for modern Web apps and networks

webrpc is a schema-driven approach to writing backend servers for the Web. Write your server's api interface in a schema format of RIDL or JSON, and t

Jan 7, 2023

Forms814 - A website builder, useful for writing data collection webapps quickly.

Forms814 - A website builder, useful for writing data collection webapps quickly.

forms814 A website builder, useful for writing data collection webapps quickly. Project Design The method in use here is to mix it with complicated fo

Oct 25, 2022

Kobiton-execute-test-buildkite-plugin - A Buildkite Plugin to (synchronously) execute an automated test script on Kobiton service

Kobiton Execute Test Buildkite Plugin A Buildkite Plugin to (synchronously) exec

Feb 10, 2022

Cf-cli-find-app-plugin - CF CLI plugin to find applications containing a search string

Overview This cf cli plugin allows users to search for application names that co

Jan 3, 2022

Twitter-plugin - Falco Plugin for Twitter Stream

Twitter Plugin This repository contains the twittter plugin for Falco, which fol

Mar 17, 2022

A Go library for connecting to HandlerSocket (github.com/ahiguti/HandlerSocket-Plugin-for-MySQL)

handlersocket-go Go library for connecting to HandlerSocket Mysql plugin. See github.com/ahiguti/HandlerSocket-Plugin-for-MySQL/ Installation $ go get

Jan 19, 2021

Yet another SIP003 plugin for shadowsocks, based on Xray-core

Yet another SIP003 plugin for shadowsocks, based on Xray-core Build go build Usage See command line args for advanced usages.

Jan 8, 2023
Matterbridge mattermost plugin

mattermost-plugin Matterbridge mattermost plugin WIP Configuration You have to create a matterbridge.toml configuration file before running make. Beca

Dec 11, 2022
Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.
Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.

Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.

Dec 27, 2022
MBotC plugin for Mattermost

Plugin Starter Template This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository.

Feb 28, 2022
Bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API
Bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)

Jan 4, 2023
An inline buildpack for deploying a mattermost-irc bridge

Matterbridge-Heroku An inline buildpack for hosting Matterbridge on Heroku. Heroku is a platform for easily deploying applications. A buildpack provid

Nov 26, 2022
Starting my way through learning Golang by setting up an HTTP server.

Lets-Go Setting up an HTTP server with Golang. Building a simple server with "net/http" library in Golang. This is a simpe server with two routes, the

Aug 22, 2022
Slash command for Slack/Mattermost to post punch lines
Slash command for Slack/Mattermost to post punch lines

Slash command pro milujipraci.cz This project is by its nature dedicated to czech or slovak speaking users, so I suggest you to either learn Czech or

Jan 18, 2022
dumpr! is a tool to capture text based tcp traffic from the receivers point of view.
dumpr! is a tool to capture text based tcp traffic from the receivers point of view.

dumpr! dumpr! is a tool to capture text based tcp traffic. The project came about for the need to capture a web request from the back end. It was also

Dec 4, 2021
A library to simplify writing applications using TCP sockets to stream protobuff messages

BuffStreams Streaming Protocol Buffers messages over TCP in Golang What is BuffStreams? BuffStreams is a set of abstraction over TCPConns for streamin

Dec 13, 2022
Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.

raw Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed. For more information about using ra

Dec 28, 2022