Skip to main content

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

  1. In Sentry, go to Project Settings → Legacy Integrations.
  2. Find Mattermost Notifications and click Configure plugin.
  3. 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
  1. Click Save changes.
  2. Click Test Plugin to send a test notification to all configured channels.

Creating a Mattermost Bot

  1. In Mattermost go to Main Menu → Integrations → Bot Accounts.
  2. Click Add Bot Account, give it a name, and save.
  3. Copy the generated token — this is the Bot Token for the plugin.
  4. 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

Metadata

Release files for sentry-mattermost-plugin 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentry-mattermost-plugin 0.1.1
File Size Uploaded
sentry_mattermost_plugin-0.1.1.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sentry-mattermost-plugin 0.1.1
File Interpreter ABI Platform
sentry_mattermost_plugin-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / sentry_mattermost_plugin-0.1.1.tar.gz

Download URL sentry_mattermost_plugin-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
769d62a2273157c890bdca7e6f2b7c40c9e13959b27210cd5410b6933ccc5781
BLAKE2b-256 checksum
How to use checksums
9a1d6a3f811e30e475e2324c3d66e2f47024036e423f2ce8d99612803c4a4fb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / sentry_mattermost_plugin-0.1.1-py3-none-any.whl

Download URL sentry_mattermost_plugin-0.1.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0d4a74be7efdbf4a12b287209aeb90b9f0544af9828c00c149b3d24e4fbfb27
BLAKE2b-256 checksum
How to use checksums
91e1159d9f241ce4dae396f61b87c503c3b7e5b2b938ada4450d00eb615fcee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page