Email relay
The email relay is your team's own sender for GitNotify's email digests. It is a small Cloudflare Worker that you deploy into your Cloudflare account. It sends from your domain, to the addresses you list. You own the mail, the addresses and the bill, which is usually nothing.
Who needs it
Section titled “Who needs it”You need a relay if your team uses a GitNotify that someone else runs, such as the hosted GitNotify, and wants personal digests by email. The host never pays for or sees your mail.
You don't need one if your GitNotify already has built-in email. A self-hosted server can send through its own SMTP server instead (Email on a self-hosted server). The status command in your chat says "built in" when that is the case.
It is not an open relay
Section titled “It is not an open relay”- GitNotify's request says only whose digest it is, as a GitHub login. The address always comes from the relay's own
RECIPIENTSlist, never from the request. - You can also list the addresses on the Worker's
send_emailbinding. Cloudflare itself then refuses any other address. - Every request is signed with a secret only you and GitNotify hold. A request older than 5 minutes, or one already seen, is refused.
- Each recipient gets at most
DAILY_CAPemails a day, 6 by default.
Free or paid
Section titled “Free or paid”Pick how your team receives mail:
| Free (Workers Free plan) | Paid (Workers Paid plan) | |
|---|---|---|
| Who can receive | only verified addresses: each person clicks a verification link from Cloudflare once | any address |
| Cost | nothing | 3,000 emails a month included, then $0.35 per 1,000. A team of 10 on two digests a day uses about 600 |
| Your domain | on Cloudflare DNS, with Email Routing turned on | on Cloudflare DNS, onboarded to Email Service for sending |
| Binding | allowed_destination_addresses required: list the verified addresses |
allowed_destination_addresses optional, but recommended |
| Good for | a small team with fixed members | teams that already pay, or change often |
On the Free plan, turning on Email Routing replaces your domain's MX records. If your domain already receives mail elsewhere, such as Google Workspace or Microsoft 365, use a subdomain such as notify.example.com for Email Routing, so your real mail is untouched. The Paid plan's sending setup doesn't take over your inbound mail.
Cloudflare's own pages: Email Service, pricing, limits and send bindings.
Set it up
Section titled “Set it up”You need a Cloudflare account with your domain on Cloudflare DNS, bun, and to be an admin in your chat: Manage Server in Discord, a workspace admin or owner (or the installer) in Slack, or a group creator or administrator in Telegram.
-
Get a secret from GitNotify. Run the email command without an address:
Chat Command Discord /digest emailSlack /gitnotify digest emailTelegram /digest email(the secret arrives by private message)GitNotify shows a new shared secret once. Keep it for step 3. Running the command again makes a new secret, and the old one stops working.
-
Deploy the relay. It lives in the
cloud/relay/folder of the GitNotify repository, self-contained, with its own dependencies:Terminal window git clone https://git.h1n054ur.dev/borderless-tech/gitnotify.gitcd gitnotify/cloud/relaybun installbunx wrangler deployThe first deploy creates the Worker,
gitnotify-email-relay, and theSEENKV namespace it uses to refuse replays. -
Give it its three settings as secrets (they are listed in
.dev.vars.example):Terminal window bunx wrangler secret put GITNOTIFY_SECRET # the secret from step 1bunx wrangler secret put RECIPIENTS # {"github-login":"them@example.com", ...}bunx wrangler secret put FROM # gitnotify@example.comRECIPIENTSmaps each person's GitHub login, the one they linked with in your chat, to their address. People who aren't listed never get email.FROMis the sender address on your domain. -
Lock it down. Required on the Free plan, recommended on Paid. In
wrangler.jsonc, list the same addresses on the binding, then deploy again:"send_email": [{ "name": "EMAIL", "allowed_destination_addresses": ["them@example.com"] }] -
Test it from your chat. Run the email command again with the relay's address:
Chat Command Discord /digest email url: https://gitnotify-email-relay.<you>.workers.devSlack /gitnotify digest email https://gitnotify-email-relay.<you>.workers.devTelegram /digest email https://gitnotify-email-relay.<you>.workers.devGitNotify sends a signed test to your address on the relay, so you need to be linked in the chat and listed in
RECIPIENTS. When the test email arrives, email digests are on. -
Turn on personal email digests. Each person chooses email for their own digest, such as
/digest me timezone: UTC times: 09:00 via: emailin Discord. See Digests and email.
The relay's address must use https://, a public host name (not an IP address, localhost or an internal name), no port and no username or password. GitNotify refuses redirects, so give the relay's own address.
What it sends
Section titled “What it sends”The Ember design, in src/render.ts: a dark, amber-accented digest with count tiles and one section each for what is broken and yours to fix, what is waiting for your review, your pull requests with changes requested, and what was fixed since the last digest. Every email has a plain-text part.
- Content: titles, logins, repository names and run numbers only, never pull request bodies or logs.
- Safety: everything from GitHub is HTML-escaped, and links only ever point to
https://github.com/. - Restyling: it is your copy, so change it as you like.
When something goes wrong
Section titled “When something goes wrong”The relay answers each request with a status, and GitNotify acts on it:
| Answer | Meaning | GitNotify does |
|---|---|---|
202 |
sent | done |
401 |
bad signature or stale timestamp | pauses email and asks an admin to check the secret |
404 |
the reader has no address in RECIPIENTS |
tells that person to ask an admin |
409 |
already handled (a replay) | nothing |
429 |
the reader's daily cap is reached | skips this one |
502 |
Cloudflare refused the send. The reason is included, never the address | retries later, then pauses email |
After three failed sends in a row, or a 401, the relay is paused for that server, workspace or group, and the status command shows it as paused. Fix the cause and run the email command with the relay's address again to test and resume it.
GET / on the relay answers {"service":"gitnotify-email-relay"}, which is a quick way to check it is deployed.
Protocol
Section titled “Protocol”GitNotify talks to the relay with protocol version 1. You only need this if you write your own relay.
POST /digestX-GitNotify-Timestamp: <unix seconds>X-GitNotify-Id: <unique delivery id>X-GitNotify-Signature: v1=<hex HMAC-SHA256(secret, "<timestamp>.<id>.<raw body>")>
{ "version": 1, "platform": "discord" | "slack" | "telegram", "kind": "digest" | "test", "reader": "<github login>", "tz": "Europe/Berlin", "slot": <ms>, "digest": { … } }A test carries no digest. The digest's shape is in cloud/relay/src/types.ts. To change or test the relay itself, see Development.