https://github.com/zefhemel/mattermost-functions
Run functions in respond to eventbus events
https://github.com/zefhemel/mattermost-functions
Last synced: about 1 year ago
JSON representation
Run functions in respond to eventbus events
- Host: GitHub
- URL: https://github.com/zefhemel/mattermost-functions
- Owner: zefhemel
- License: apache-2.0
- Created: 2022-09-21T18:07:41.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-11T13:35:24.000Z (over 3 years ago)
- Last Synced: 2025-01-20T21:17:04.451Z (over 1 year ago)
- Language: Go
- Size: 547 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MatterMost Functions
For now, you need to manually install [Deno](https://deno.land), on Mac: `brew install deno` to make this work.
To deploy, make sure `PluginSettings` -> `EnableUploads` is set to `true` in your `config.json` file, then run:
```bash
make deploy
```
## Usage
The UI is in the Admin Console under "Plugins" -> "Mattermost Functions".
Here you can configure the personal access token that will be passed to a function (via the `init` call, see below). And then one or more events and functions to trigger.
Example function:
```javascript
import {Client4} from "https://esm.sh/@mattermost/client";
let client;
function init(cfg) {
client = new Client4();
client.url = cfg.api_url;
client.token = cfg.api_token;
}
async function handle(event) {
console.log("Got this event", event);
await client.createPost({
channel_id: "xgjbhz6btj8b7b31fgpn5ge38h", // replace with your channel id
message: `Message: ${event.message}`
});
}
```