forked from clairton/unoapi-cloud
-
Notifications
You must be signed in to change notification settings - Fork 3
STATUS_BROADCAST
wiki-bot edited this page May 3, 2026
·
5 revisions
This document details how Unoapi handles Stories (Status) via Baileys and the protections added to avoid socket disconnects when large recipient lists include invalid numbers.
to = "status@broadcast"-
typeis a content type supported by Baileys (text, image, video, etc.) -
options.statusJidList = [numbers | JIDs]— the recipient list to relay after initial send
Auto-fill (image/video only):
- If statusJidList is empty or null and type is image/video, Unoapi auto-fills from Redis contact-info keys (unoapi-contact-info::*).
- This happens before normalization; if the list is still empty, relayMessage is skipped.
Implemented in src/services/socket.ts inside the send() path for status@broadcast:
- For each entry in
statusJidList, callexists(raw)which resolves to a valid JID if the number has WhatsApp, orundefinedotherwise. - Filter out all
undefined(invalid numbers), log a warning with a small preview of skipped entries. - Optionally normalize LID JIDs to PN based on
STATUS_ALLOW_LIDindefaults.ts. - Deduplicate the final list.
If, after normalization, there are no valid recipients, the relayMessage step is skipped.
To assist monitoring and client UX, the HTTP response includes two extra fields for Status sends:
-
status_skipped: raw inputs that were removed for having no WhatsApp account. -
status_recipients: count of valid recipients relayed.
These fields are added without breaking the Cloud API response structure (messages/contacts).
- Recipient normalization optionally converts LID JIDs to PN when
STATUS_ALLOW_LID=false; whentrue(default), LIDs are allowed in the recipient list. - Webhook payloads still prefer PN for
wa_id/recipient_idwhenever safely resolvable; unresolved LIDs are exposed through stable identifier fields where available instead of putting@lidinwa_id. - Internally, the transport may use LID to improve session availability and reduce decrypt issues; this does not change the external webhook shape.
- Large lists may contain numbers without WhatsApp, which previously caused Baileys errors and could drop the socket.
- By filtering and normalizing upfront, Unoapi sends only to valid recipients and keeps the socket stable.