Skip to main content

Appendix — Headers

In one line: every email and HTTP header HIGHFIELD sets or reads, with where and why — because headers are where threading, auth, dedup, and loop-prevention actually live, and they're invisible in a feature description.

Email headers — SET (outbound)

HeaderWhere (file:line)PurposeConsequence if wrong
Auto-Submitted: auto-repliedemail-notifications.ts:143RFC-3834 — tell recipient's server our mail is automatedRecipient autoresponders could bounce back → loop (inbound guard is the real backstop)
X-Auto-Response-Suppress: Allemail-notifications.ts:144Microsoft/Outlook — suppress auto-repliesCosmetic if ignored
Precedence: auto_replyemail-notifications.ts:145Common bulk/auto markerCosmetic if ignored
inReplyTo / in_reply_to / parentMessageIdemail-notifications.ts:125-129Threading hint to Lua send-message (multiple guessed field names)Email arrives unthreaded
referencesemail-notifications.ts:130-132Full References chain for threadingEmail arrives unthreaded
channelId (LUA_EMAIL_CHANNEL_ID)email-notifications.ts:108-111Route send through property@highfieldproperty.ieTenant sees chat@heylua.ai
Authorization: Bearer <LUA_API_KEY>email-notifications.ts:153Auth to Lua send-message API401, email not sent
Content-Type: application/jsonemail-notifications.ts:152Request body formatAPI rejects payload
AgentMail Authorization: Bearer <AGENTMAIL_API_KEY>agentmail.ts:38Auth to AgentMail APIAgentMail call fails

The synthetic threading Message-IDs that anchor threads (<ticket-<id>-<party>@highfieldproperty.ie> + the party's real inbound Message-ID) are computed in email-thread-anchor.ts (buildSyntheticRoot:42-46, buildThreadAnchor:99-122) and passed into notifyByEmail as inReplyTo/references. Domain from EMAIL_THREAD_DOMAIN (default highfieldproperty.ie).

Email headers — READ (inbound)

HeaderWhere (file:line)PurposeConsequence if wrong
from / sender / fromAddress / Fromauto-reply-guard.preprocessor.ts:44-45; inbound-email.webhook.ts:57-98Identify sender; loop detectionMis-identify sender → wrong BC lookup / missed loop guard
Auto-Submittedauto-reply-detection.ts:49Detect automated mailReply to a bounce → loop
X-Auto-Response-Suppressauto-reply-detection.ts:55Detect OOO/autoLoop risk
Precedenceauto-reply-detection.ts:61Detect bulk/list/autoLoop risk
List-Id / List-Unsubscribe / Feedback-IDauto-reply-detection.ts:67-69Detect mailing-list/bulkReply to a list → loop/spam
X-Autoreply / X-Loopauto-reply-detection.ts:72-75Detect autorespondersLoop risk
Reply-To / From (address scan)auto-reply-detection.ts:78Detect no-reply/daemon sendersLoop risk
In-Reply-To / in_reply_toinbound-email.webhook.ts:134,139; thread-ticket-resolver.ts:39-40Bind inbound to a ticket threadThread split / wrong-ticket bind (cross-tenant risk)
References / referencesinbound-email.webhook.ts:135-142; thread-ticket-resolver.ts:45-55Thread root resolution (tier 3)Loses thread continuity
thread_idinbound-email.webhook.ts:138Fallback thread keyThread split
Message-ID / message_id / messageIdinbound-email.webhook.ts:57; thread-ticket-resolver.ts:38; current-thread-ticket-injection.preprocessor.ts:353-369Stash inbound id for future thread anchoring; thread key of last resortNo future threading for this party
subjectinbound-email.webhook.ts:57,144; thread-ticket-resolver.ts:42-43Extract MT-… id (tier 2), property-from-subject, reply subjectWrong ticket binding / wrong property routing
attachments[].content_type / content_disposition / content_idinbound-email.webhook.ts:212-221,341-344Filter images, detect inline vs paperclip, CID cross-checkMissed/dropped images; false "no photo" guidance

HTTP headers (outbound API requests)

HeaderOnPurpose
Authorization: Bearer <token>BC standard + custom APIOAuth2 access token from Entra
Authorization: Bearer <LUA_API_KEY>Lua send-messageAPI auth
Authorization: Bearer <AGENTMAIL_API_KEY>AgentMailAPI auth
If-Match: <etag> or *BC PATCH (entity / attachmentContent)Optimistic concurrency; * used on attachment content because BC mutates internal timestamps on read, staling the etag (bc-client.ts:357-371)
Content-Type: application/jsonall JSON requestsBody format

HTTP headers (inbound webhook)

The inbound webhooks rely on body/event shape, not header signatures, except:

MechanismWhereNotes
HMAC token in query (?token=)approval-decision.webhook.ts:21-95Not an HTTP header — a signed token param; constant-time verified
AgentMail event-shape checkinbound-email.webhook.ts:37-52event_type === 'message.received' + message.message_idno signature verification

⚠️ No inbound webhook verifies an HTTP signature header. See Security — 9 of 11 webhooks are unauthenticated.