2022-07-24 19:39:37 +00:00
|
|
|
```meta
|
|
|
|
type: plug
|
|
|
|
uri: github:silverbulletmd/silverbullet-mattermost/mattermost.plug.json
|
|
|
|
repo: https://github.com/silverbulletmd/silverbullet-mattermost
|
|
|
|
author: Zef Hemel
|
|
|
|
```
|
2022-10-12 09:47:13 +00:00
|
|
|
|
2022-07-25 14:51:46 +00:00
|
|
|
<!-- #include "https://raw.githubusercontent.com/silverbulletmd/silverbullet-mattermost/main/README.md" -->
|
2022-10-12 09:47:13 +00:00
|
|
|
|
2022-07-25 14:51:46 +00:00
|
|
|
# Mattermost plug for Silver Bullet
|
2022-10-12 09:47:13 +00:00
|
|
|
|
|
|
|
Provides an `mm-saved` query provider (and maybe more in the future). Please
|
|
|
|
follow the installation, configuration sections, and have a look at the example.
|
2022-07-24 19:39:37 +00:00
|
|
|
|
2022-07-25 14:51:46 +00:00
|
|
|
## Installation
|
2022-10-12 09:47:13 +00:00
|
|
|
|
2022-07-25 14:51:46 +00:00
|
|
|
Open your `PLUGS` note in SilverBullet and add this plug to the list:
|
|
|
|
|
|
|
|
```
|
|
|
|
- github:silverbulletmd/silverbullet-mattermost/mattermost.plug.json
|
|
|
|
```
|
|
|
|
|
|
|
|
Then run the `Plugs: Update` command and off you go!
|
|
|
|
|
2022-07-24 19:39:37 +00:00
|
|
|
## Configuration
|
2022-10-12 09:47:13 +00:00
|
|
|
|
|
|
|
You need two bits of configuration to make this plug work. In `SETTINGS` provide
|
|
|
|
the `mattermostUrl` and `mattermostDefaultTeam` settings, they default to the
|
|
|
|
following:
|
2022-07-24 19:39:37 +00:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
mattermostUrl: https://community.mattermost.com
|
|
|
|
mattermostDefaultTeam: core
|
|
|
|
```
|
|
|
|
|
2022-10-12 09:47:13 +00:00
|
|
|
In `SECRETS` provide a Mattermost personal access token (or hijack one from your
|
|
|
|
current session):
|
2022-07-24 19:39:37 +00:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
mattermostToken: your-token
|
|
|
|
```
|
|
|
|
|
2022-10-12 09:47:13 +00:00
|
|
|
To make this look good, it's recommended you render your query results a
|
|
|
|
template. Here is one to start with, you can keep it in e.g.
|
|
|
|
`templates/mm-saved`:
|
2022-07-24 19:39:37 +00:00
|
|
|
|
|
|
|
[{{username}}]({{desktopUrl}}) in **{{channelName}}** at {{updatedAt}} {[Unsave]}:
|
|
|
|
|
|
|
|
{{prefixLines (substring message 0 300 " ... (More)") "> "}}
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2022-10-12 09:47:13 +00:00
|
|
|
Note that the `{[Unsaved]}` "button" when clicked, will unsave the post
|
|
|
|
automatically 😎
|
2022-07-24 19:39:37 +00:00
|
|
|
|
|
|
|
## Query sources
|
|
|
|
|
2022-10-12 09:47:13 +00:00
|
|
|
- `mm-saved` fetches (by default 15) saved posts in Mattermost
|
2022-07-24 19:39:37 +00:00
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
Example uses (using the `template/mm-saved` template above):
|
|
|
|
|
|
|
|
<!-- #query mm-saved order by updatedAt desc limit 5 render "template/mm-saved" -->
|
|
|
|
|
2022-07-25 14:51:46 +00:00
|
|
|
<!-- /query -->
|
2022-10-12 09:47:13 +00:00
|
|
|
|
2022-07-25 14:51:46 +00:00
|
|
|
<!-- /include -->
|