feat: WhatsApp Business API notification sink (I-011, scaffold) - #68
Open
lopster568 wants to merge 1 commit into
Open
feat: WhatsApp Business API notification sink (I-011, scaffold)#68lopster568 wants to merge 1 commit into
lopster568 wants to merge 1 commit into
Conversation
Add internal/notify/whatsapp: a Notifier for the Meta WhatsApp Business Cloud API. Disabled by default and inert until WHATSAPP_TOKEN, WHATSAPP_PHONE_ID and WHATSAPP_TO are set. Supports text and pre-approved template messages; fully unit-tested against httptest, no live Meta API. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
internal/notify/whatsapp: a notification sink backed by the Meta WhatsApp Business (Cloud) API, so alert and report paths can deliver messages over WhatsApp.Notifierinterface (Notify(ctx, message)+Enabled()) for callers to depend on.Clientthat POSTs tohttps://graph.facebook.com/v.../{phone_number_id}/messageswith a bearer token.Notify) and pre-approved template messages (NotifyTemplate).WHATSAPP_TOKEN,WHATSAPP_PHONE_ID,WHATSAPP_TOviaConfigFromEnv/NewFromEnv.Why
Indian SMBs, schools and hospitals live on WhatsApp; delivering security alerts and daily reports there is far more actionable than email. This lands the integration wiring now so it can be switched on with credentials once approved.
How
Config.Enabled()requires all three of token, phone ID and recipient; if any is empty the sink is a no-op.v20.0) and base URL are overridable, the latter purely as a test injection point.post()marshals the payload, setsAuthorization: Bearer <token>andContent-Type: application/json, and treats non-2xx as an error (surfacing status + body).Tests
Hermetic, no real Meta API — an
httptestserver stands in:messaging_product,recipient_type,to,type,text.body).en_US, body component parameters).Enabled()matrix andConfigFromEnvenv parsing.gofmt,go build ./...,go vet ./...,go test ./...all green.Note
Scaffolding. This is disabled by default and completely inert without credentials. Actually delivering messages requires an approved WhatsApp Business Account (WABA) and, for templates, a pre-approved message template from Meta. The sink stays a no-op until that approval is in place and credentials are configured.
🤖 Generated with Claude Code