PUL-16: minimal WhatsApp Cloud API pilot, for App Review - #13
Merged
Conversation
App Review's screencast and API-test-call requirements need a real,
working feature to demonstrate -- nothing in the Cloud API epic
(PUL-13 through PUL-20) existed in code yet, only Jira tracking and
Meta-side account setup.
This is a deliberately minimal, real slice: one working send
(whatsapp_business_messaging) and one working template list
(whatsapp_business_management), against Meta's own free test business
number (temporary token from the App Dashboard's API Setup page, in
.env.local, never committed). Not the merchant-facing send path --
that's PUL-18, gated on the billing decision (PUL-15) and template
workflow (PUL-17). Not reachable from the main sidebar nav.
- src/lib/whatsapp-cloud/client.ts: new, parallel to (not replacing)
src/lib/whatsapp/client.ts's gateway client, per PUL-16's own scope
note in the epic.
- src/app/api/whatsapp-cloud/{test-send,templates}: two thin routes,
same requireTenant + hand-typed-recipient-only pattern as the
existing /api/whatsapp/test route.
- src/app/(app)/whatsapp-cloud-pilot: one page to record the App
Review screencast against.
- src/proxy.ts: added to PROTECTED_PAGES.
- src/lib/openapi.ts: both new routes documented, new tag added.
This is a partial slice of PUL-16's full scope (no webhook receiver,
no template-message sending yet) -- staying open after this merges,
not moving to Done.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Two real bugs found by actually testing against Meta's live API:
1. sendCloudTextMessage (free-form) only delivers within an open 24h
customer-service window -- Meta's API accepts the call and returns
a real message id outside that window, but never delivers it. A
pre-verified test recipient is exempt from needing App-Review
production access, but NOT from this window rule, which is
universal. Confirmed by a real send that "succeeded" per the API
response but never arrived.
2. listCloudMessageTemplates tried to resolve the WABA id from the
phone number node via a `whatsapp_business_account` field that
does not exist on that node ("(#100) Tried accessing nonexisting
field"). There is no documented way to derive it from the phone
number id -- it's a third env var now, read directly from the App
Dashboard's "WhatsApp Business account ID" shown next to the test
number.
Fix for (1): added sendCloudTemplateMessage, using the "hello_world"
template every WABA has pre-approved from creation -- delivers
reliably with no open-window requirement, same as real merchant sends
(order confirmations, campaigns) always will need. The pilot page and
route now default to template mode, with free-form text still
available and clearly labelled with the window caveat.
Fix for (2): WHATSAPP_CLOUD_TEST_WABA_ID env var, set directly rather
than derived.
Co-Authored-By: Claude Sonnet 5 <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.
Jira issue
PUL-16 (partial slice)
Summary
App Review's screencast/API-test-call requirements need a real feature
to demonstrate. This is a deliberately minimal, real slice: one working
send (whatsapp_business_messaging) and one working template list
(whatsapp_business_management), against Meta's own free test business
number. Not the merchant-facing send path (PUL-18) -- just enough to
legitimately pass App Review.
Checks
npm run typechecknpm run lint(0 errors, 5 pre-existing warnings unrelated)node scripts/check-openapi.mjs(42/42 routes documented)(proxy.ts gating works), no server compile errors
waiting on the Phone Number ID from the App Dashboard
Note
This is a partial slice of PUL-16's full scope (no webhook receiver,
no template-message sending). Staying open after merge, not Done.