feat(alerts): include uid, folder, hasAttachments in webhook payload#18
Open
nickgorodilov wants to merge 1 commit intocodefuturist:mainfrom
Open
feat(alerts): include uid, folder, hasAttachments in webhook payload#18nickgorodilov wants to merge 1 commit intocodefuturist:mainfrom
nickgorodilov wants to merge 1 commit intocodefuturist:mainfrom
Conversation
Webhook consumers need the IMAP UID to fetch full email content via get_email after receiving an alert. The data is already available on EmailMeta but was not threaded through AlertPayload to the webhook JSON body. Closes codefuturist#17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uid(IMAP UID),folder(mailbox name), andhasAttachmentstoAlertPayloadand webhook JSON bodyhooks.service.tsCloses #17
Motivation
Webhook consumers that receive email alerts currently cannot fetch the full email content because the payload lacks the IMAP UID. The
uidis already available onEmailMeta.idat all call sites -- it was just not being passed through to the webhook.With this change, a consumer can call
get_emailwith the receiveduidto retrieve the full body, attachments, and headers.Changes
notifier.service.ts: Addeduid?,folder?,hasAttachments?toAlertPayloadinterface. Added these fields to the webhook JSON body insendWebhook().hooks.service.ts: Passemail.meta.id,email.mailbox,email.meta.hasAttachmentsat all 3 sites whereAlertPayloadis constructed (applyStaticRule,notifyBatch,applySingleTriage).Backward compatibility
All new fields are optional in
AlertPayloadand default tonull/falsein the webhook JSON. Existing consumers are unaffected.New webhook payload shape
{ "event": "email.normal", "account": "personal", "uid": "12345", "folder": "INBOX", "sender": { "name": "John", "address": "john@example.com" }, "subject": "Hello", "hasAttachments": true, "priority": "normal", "labels": [], "rule": null, "timestamp": "2026-03-20T..." }Test plan
npx tsc --noEmitpassesvitest run-- all 150 tests passbiome checkpasses on changed files