Architecture: hbf-broadcast
C4 Component Diagram
Key Flows
One-Shot Broadcast
A broadcast with method=ONE_SHOT is picked up from hbf-core, the channel authenticates using the bot deployment credentials, all subscribers across all groups are collected, and the message is sent in a single call. The broadcast status is set to COMPLETE on success or ERROR on failure.
Batched Broadcast (multi-cycle)
A broadcast with method=BATCHES is processed incrementally across scan cycles:
- First scan: status is
PENDING. Subscriber list is fetched, response records initialized assent=false, first batch is sent. If more remain, status is set toWAITINGwithcurrentBatchandtotalBatchessaved. - Subsequent scans: status is
WAITING. Non-receivers are fetched from hbf-core responses, next batch is sent, counters updated. Continues until the subscriber list is exhausted, then status becomesCOMPLETE.
Subscriber info (name, email) is resolved from hbf-core and falls back to the channel's own user info API. New subscribers found during delivery are created in hbf-core.
Per-Tenant Deduplication
During each scan cycle, at most one broadcast per (tenantId, platform) pair is dispatched. Currently-sending broadcasts block new ones for the same pair. Broadcasts are ordered by sendAt ascending before selection.