Redbot GitHub Forwarder
Discord webhook ingestion engine and developer notification bridge
Overview
The Redbot GitHub Forwarder is an asynchronous Python cog built for Red Discord Bot to provide real-time development observability.
It exposes a dedicated HTTP endpoint to receive GitHub repository webhooks, verifies incoming payload authenticity using HMAC-SHA256 signatures, and transforms raw event payloads into structured Discord embeds across team channels.
Event Processing Pipeline
The cog processes repository events through four distinct stages:
| Stage | Process | Action |
|---|---|---|
| 1. Ingress & Auth | aiohttp HTTP Server | Receives POST request and validates HMAC-SHA256 signature |
| 2. Event Parser | Payload Normalizer | Parses JSON payload into structured Python dataclasses |
| 3. Channel Router | Rules Engine | Maps repository name and event type to destination Discord channel IDs |
| 4. Dispatcher | Discord.py Embedder | Formats color-coded status embeds and sends messages asynchronously |
1. Ingress and cryptographic verification
GitHub delivers webhook payloads via HTTPS POST requests. The cog calculates the payload’s HMAC-SHA256 digest using a configured secret key and validates it against the X-Hub-Signature-256 header before processing to prevent spoofed events.
2. Event normalization and formatting
The parser supports five distinct GitHub event categories:
- Pushes & Commits: Summarizes branch, author, commit count, and individual commit messages with direct SHA links.
- Pull Requests: Tracks PR opens, code reviews, approvals, conflicts, and merges.
- Workflow Runs (CI/CD): Formats GitHub Actions build status (
success,failure,in_progress) with elapsed duration. - Releases & Tags: Broadcasts new semver releases and changelogs.
- Issues & Discussions: Notifies on bug reports, triage labels, and milestone progress.
3. Configurable channel routing
Server administrators configure channel destinations per repository or per event category using Redbot slash commands. This keeps high-frequency commit logs in dedicated activity feeds while routing release announcements to public announcement channels.