All Projects → mattermost → mattermost-plugin-starter-template

mattermost / mattermost-plugin-starter-template

Licence: Apache-2.0 License
Build scripts and templates for writing Mattermost plugins.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to mattermost-plugin-starter-template

mattermost-plugin-agenda
Mattermost plugin to handle meeting agendas
Stars: ✭ 20 (-72.97%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-demo
A demo of what Mattermost plugins can do.
Stars: ✭ 52 (-29.73%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-antivirus
Antivirus plugin for scanning files uploaded to Mattermost
Stars: ✭ 30 (-59.46%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-memes
Add culture to your Mattermost with memes 🔌
Stars: ✭ 59 (-20.27%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-google-calendar
Mattermost Google Calendar Plugin
Stars: ✭ 22 (-70.27%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-walltime
Timezone Message Convert for Mattermost 🕛 🕒 🕕 🕘
Stars: ✭ 25 (-66.22%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-alertmanager
AlertManager Bot for Mattermost
Stars: ✭ 48 (-35.14%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-custom-attributes
Mattermost plugin for adding custom attributes to users!
Stars: ✭ 26 (-64.86%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-wrangler
Manage Mattermost Messages Masterfully!
Stars: ✭ 33 (-55.41%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-voice
Mattermost plugin for voice messaging. 🎤 🔉
Stars: ✭ 64 (-13.51%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-zoom
Zoom plugin for Mattermost 🔌
Stars: ✭ 93 (+25.68%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-email-reply
No description or website provided.
Stars: ✭ 25 (-66.22%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-skype4business
No description or website provided.
Stars: ✭ 15 (-79.73%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-autotranslate
No description or website provided.
Stars: ✭ 34 (-54.05%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-autolink
Automatically rewrite text matching a regular expression into a markdown link.
Stars: ✭ 100 (+35.14%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-rtl
Adds RTL support to Mattermost
Stars: ✭ 52 (-29.73%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-github
GitHub plugin for Mattermost
Stars: ✭ 112 (+51.35%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-jenkins
A Mattermost plugin to interact with Jenkins
Stars: ✭ 25 (-66.22%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-apps
Powers the Mattermost App Framework
Stars: ✭ 29 (-60.81%)
Mutual labels:  mattermost, mattermost-plugin
mattermost-plugin-todo
Mattermost plugin for tracking to do items
Stars: ✭ 45 (-39.19%)
Mutual labels:  mattermost, 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. In order for the below options to work, you must first enable plugin uploads via your config.json or API and restart Mattermost.

    "PluginSettings" : {
        ...
        "EnableUploads" : true
    }

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).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].