Skip to content

feat(alerts): include uid, folder, hasAttachments in webhook payload#18

Open
nickgorodilov wants to merge 1 commit intocodefuturist:mainfrom
nickgorodilov:feat-webhook-uid-fields
Open

feat(alerts): include uid, folder, hasAttachments in webhook payload#18
nickgorodilov wants to merge 1 commit intocodefuturist:mainfrom
nickgorodilov:feat-webhook-uid-fields

Conversation

@nickgorodilov
Copy link
Copy Markdown

Summary

  • Add uid (IMAP UID), folder (mailbox name), and hasAttachments to AlertPayload and webhook JSON body
  • Thread these fields through all 3 payload construction sites in hooks.service.ts

Closes #17

Motivation

Webhook consumers that receive email alerts currently cannot fetch the full email content because the payload lacks the IMAP UID. The uid is already available on EmailMeta.id at all call sites -- it was just not being passed through to the webhook.

With this change, a consumer can call get_email with the received uid to retrieve the full body, attachments, and headers.

Changes

  • notifier.service.ts: Added uid?, folder?, hasAttachments? to AlertPayload interface. Added these fields to the webhook JSON body in sendWebhook().
  • hooks.service.ts: Pass email.meta.id, email.mailbox, email.meta.hasAttachments at all 3 sites where AlertPayload is constructed (applyStaticRule, notifyBatch, applySingleTriage).

Backward compatibility

All new fields are optional in AlertPayload and default to null/false in 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 --noEmit passes
  • vitest run -- all 150 tests pass
  • biome check passes on changed files

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webhook payload missing uid, messageId, folder, and hasAttachments fields

1 participant