50 lines
2.1 KiB
Markdown
50 lines
2.1 KiB
Markdown
---
|
|
tags: [project-drogheda, notifications, mattermost]
|
|
project: Project Drogheda
|
|
author: Helgen CTO
|
|
date: 2026-06-20
|
|
status: Active
|
|
---
|
|
|
|
# Mattermost notifications
|
|
|
|
There is **no Mattermost MCP connector** available (checked the connector registry),
|
|
so we post to Mattermost the simple, robust way: an **Incoming Webhook** + the
|
|
dependency-free `notify_mattermost.py`. No secrets in the repo — the webhook URL
|
|
lives in an environment variable.
|
|
|
|
## One-time setup
|
|
|
|
1. **Create the webhook** in Mattermost: *Main Menu → Integrations → Incoming
|
|
Webhooks → Add Incoming Webhook*. Choose the target channel (e.g. `#drogheda`)
|
|
and copy the URL: `https://<your-mattermost>/hooks/xxxxxxxxxxxxxxxxx`.
|
|
*(If "Integrations" is hidden, a System Admin must enable Incoming Webhooks in
|
|
System Console → Integrations → Integration Management.)*
|
|
2. **Export the URL** (add to your shell profile or a secrets manager — not git):
|
|
```bash
|
|
export MATTERMOST_WEBHOOK_URL="https://<your-mattermost>/hooks/xxxxxxxxxxxxxxxxx"
|
|
```
|
|
|
|
## Use
|
|
|
|
```bash
|
|
python3 notify_mattermost.py "🛰️ Drogheda: anti-jump hotfix deployed ✅"
|
|
python3 notify_mattermost.py --channel drogheda --username "Drogheda Bot" "RTK fix restored on ZPM 020"
|
|
echo "line 1\nline 2" | python3 notify_mattermost.py - # read from stdin
|
|
python3 notify_mattermost.py --dry-run "test" # print payload, don't send
|
|
```
|
|
|
|
Markdown works in the message body (tables, bullets, `code`). The script exits `0`
|
|
on success, `2` on config/usage error, `1` on a send failure.
|
|
|
|
## Wire it into workflows
|
|
|
|
- **Hackathon / CI:** call it at the end of a deploy or test step.
|
|
- **Backend health:** the `htracker` notifier already does Discord+SMTP; a Mattermost
|
|
sink can be added the same way, or pipe its events through this script.
|
|
- **Scheduled status:** cron / launchd → a daily "fleet online/offline" digest.
|
|
|
|
> If we later want richer two-way Mattermost integration (read channels, react to
|
|
> messages), build a small custom MCP with the `mcp-builder` skill — but for
|
|
> push notifications the webhook above is sufficient and lower-maintenance.
|