Documentation
¶
Overview ¶
Package whatsapp is the gateway's WhatsApp adapter over the Meta Cloud API. Like GitHub it receives inbound messages by webhook (a GET verification handshake plus POSTed message events) and, unlike GitHub, can reply — so it exposes Send, posting through the Graph API. It stays INERT until the Meta business is verified: the gateway only mounts it when whatsapp.active is set in gateway.yaml (see internal/gateway/config), because Meta verification is an external account state the code can't observe. The user stores the access and verify tokens in the global .env (WHATSAPP_ACCESS_TOKEN, WHATSAPP_VERIFY_TOKEN); the phone number id is a non-secret setting.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is a WhatsApp Cloud API connection.
func New ¶
New builds a WhatsApp channel from the phone number id and its tokens. appSecret is the Meta app secret used to verify inbound message signatures; it must be non-empty for the handler to accept POSTed messages. mediaDir is the gateway media spool inbound images/voice notes/documents are downloaded into; "" disables media handling (text messages still flow).
func (*Channel) Handler ¶
Handler returns the webhook HTTP handler: GET performs Meta's verification handshake; POST parses inbound messages and forwards them as Inbound.
func (*Channel) Send ¶
Send posts a text reply to a conversation (the recipient's phone number), split with the shared chunker — WhatsApp rejects over-long bodies, and this was the one adapter bypassing the shared splitter. A synthesized voice rendition (VoicePath) is uploaded and sent first as an audio message, best-effort — the text always follows.