What problem does it solve?
It standardizes how notification “envelopes” are produced and enqueued so downstream consumers can coalesce edits, route announces, and dead-letter failures reliably instead of sending inconsistent or malformed payloads.
Core Features & Use Cases
- Canonical Redis Envelope Production: Builds
{ v, id, ts, expires_at, room, type, message|card, extra, fallback_webhook_url } in the exact shape expected by the notification consumer.
- Correct Room Resolution & Safety Guardrails: Ensures
room is validated through CHANNELS so thread IDs or unknown rooms are never written into envelopes.
- Coalescing, Tracking, and GitHub Event Handling: Supports edit-window merging via
extra.dedup_key, and lets the consumer derive GitHub dedup keys using extra.event_type, extra.repo, and raw webhook extra.data.
- Dead-Letter and Observability Compatibility: Produces envelopes that fail into
notif:dead with appropriate metadata when errors occur, and can be tested/verified against consumer expectations.
Quick Start
Use notif-envelope to enqueue a correctly shaped notification envelope to the InterServer Redis notif:queue by first resolving your target room through CHANNELS, then constructing the envelope with type: msg or type: card, and finally LPUSHing JSON.stringify(envelope) into k('queue').