Plugin for Sentry which allows sending notifications to a self-hosted Mattermost instance.
Project description
sentry-mattermost-plugin
A Sentry plugin that sends issue notifications to a self-hosted Mattermost instance via the Mattermost Bot API.
Official Repo seems to be outdated. So here's alternative.
Inspired by sentry-telegram.
Requirements
- Sentry (self-hosted)
- Python 3.8+
- A Mattermost Bot account with a token
Installation
Install the package into Sentry's Python environment:
pip install sentry-mattermost-plugin
Or in development mode from source:
git clone https://github.com/masstek/sentry-mattermost-plugin
cd sentry-mattermost
pip install -e .
Restart Sentry after installation so the entry point is picked up.
Configuration
- In Sentry, go to Project Settings → Legacy Integrations.
- Find Mattermost Notifications and click Configure plugin.
- Fill in the fields:
| Field | Description |
|---|---|
| Mattermost Host | Base URL of your Mattermost instance, e.g. https://mattermost.company.com |
| Bot Token | Access token for the Mattermost Bot account |
| Channel IDs | One channel ID per line. Find IDs via Mattermost → channel name → View Info |
| Message Template | Optional. Supports {project_name}, {url}, {title}, {message}, {tag[key]} |
| Verify SSL Certificate | Uncheck if your instance uses a self-signed certificate |
- Click Save changes.
- Click Test Plugin to send a test notification to all configured channels.
Creating a Mattermost Bot
- In Mattermost go to Main Menu → Integrations → Bot Accounts.
- Click Add Bot Account, give it a name, and save.
- Copy the generated token — this is the Bot Token for the plugin.
- Add the bot to the channels it needs to post in.
Message Template
The default template is:
*[Sentry]* {project_name} | {title}
{url}
{message}
Available variables:
| Variable | Description |
|---|---|
{project_name} |
Sentry project name |
{url} |
Link to the Sentry issue |
{title} |
Error title (truncated to 500 characters) |
{message} |
Error message |
{tag[key]} |
Value of a Sentry tag by key, e.g. {tag[environment]}. Returns [NA] if absent. |
Mattermost Markdown is supported in the template.
Running Tests
pip install pytest pytest-cov requests django
pytest tests/ --cov=sentry_mattermost_plugin --cov-report=term-missing
No Sentry installation is required to run the tests.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sentry_mattermost_plugin-0.1.1.tar.gz.
File metadata
- Download URL: sentry_mattermost_plugin-0.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
769d62a2273157c890bdca7e6f2b7c40c9e13959b27210cd5410b6933ccc5781
|
|
| MD5 |
d1fa733291b3efa45d7c3cdf7db26c37
|
|
| BLAKE2b-256 |
9a1d6a3f811e30e475e2324c3d66e2f47024036e423f2ce8d99612803c4a4fb9
|
File details
Details for the file sentry_mattermost_plugin-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sentry_mattermost_plugin-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0d4a74be7efdbf4a12b287209aeb90b9f0544af9828c00c149b3d24e4fbfb27
|
|
| MD5 |
f0b62c7fb4e0273c36e17d8dcc3cf4b7
|
|
| BLAKE2b-256 |
91e1159d9f241ce4dae396f61b87c503c3b7e5b2b938ada4450d00eb615fcee1
|