-
Notifications
You must be signed in to change notification settings - Fork 3
WHATSAPP_EMBEDDED
This guide focuses on WhatsApp Embedded/Meta-like onboarding clients (for example, Chatwoot Embedded flow).
UNO provides Graph-like compatibility for the onboarding/runtime calls most Embedded clients require, while preserving UNO legacy behavior.
This does not replace the real Meta/Facebook Embedded Signup popup. Clients such as Chatwoot still need real Meta app settings to start the official popup flow unless the client itself is patched to use a UNO-specific fake Embedded flow.
-
GET /:version/oauth/access_token(compat token exchange) -
GET /:version/debug_token(includesgranular_scopes.target_ids) GET /:version/me/whatsapp_business_accountsGET /:version/:business_account_id/phone_numbers-
GET /:version/:phone_number_id?fields=...(health/status-like payload) -
POST /:version/:business_account_id/subscribed_apps(compat no-op success) -
DELETE /:version/:business_account_id/subscribed_apps(compat no-op success) POST /:version/:phone_number_id/messagesGET /:version/:media_id
- Session is registered.
-
webhookForward.phoneNumberIdis present (legacy value is supported). -
webhookForward.businessAccountIdcan be empty; UNO auto-generates a stable value. - Authentication token available (
authTokenorUNOAPI_AUTH_TOKEN).
For the official Chatwoot/Meta Embedded Signup UI, these values are still Meta/Facebook values:
- WhatsApp App ID
- WhatsApp App Secret
- WhatsApp Configuration ID
- WhatsApp API Version, for example
v22.0
UNO does not currently fake the Facebook SDK popup or the Configuration ID validation step. The current compatibility layer starts at the Graph-like API calls that happen after the client has an access token or is configured to call UNO directly.
In practice:
Meta real: opens Embedded popup and provides the initial app/config/code flow.
UNO: answers Graph-like discovery/runtime calls for registered UNO sessions.
To simulate the entire Embedded experience without real Meta app settings, the client application would need a UNO-specific/fake Embedded flow.
UNO does not create a real Meta business account. It exposes a Graph-like discovery flow using the sessions already registered in UNO:
- The Embedded client exchanges a setup code:
GET /v19.0/oauth/access_token?client_id=...&code=...- UNO returns a short-lived local token in the same shape expected from Graph.
- The client validates/discovers token permissions:
GET /v19.0/debug_token?input_token=<token>- UNO returns
whatsapp_business_managementandwhatsapp_business_messagingscopes. -
granular_scopes.target_idscontains the generated or configuredbusinessAccountId.
- The client lists WhatsApp Business Accounts:
GET /v19.0/me/whatsapp_business_accounts- UNO scans authorized sessions and returns one
{ id, name }per session WABA mapping. -
namecomes from the sessionlabelwhen available.
- The client lists phone numbers from that business account:
GET /v19.0/<business_account_id>/phone_numbers- UNO resolves
<business_account_id>back to the real session phone and returns a Meta-like phone object.
- Runtime calls use Meta IDs:
POST /v19.0/<phone_number_id>/messagesGET /v19.0/<phone_number_id>?fields=...GET /v19.0/<media_id>
Internally, UNO stores Redis mappings:
phone_number_id -> session_phone
business_account_id -> session_phone
If businessAccountId is not configured, UNO deterministically generates one from the session phone and phoneNumberId when the session config is loaded. phoneNumberId itself is never auto-changed.
- Base URL points to UNO.
- Use UNO token as API key/bearer where needed.
- Ensure webhook callback targets UNO:
https://<uno-domain>/webhooks/whatsapp
- Validate:
GET /v19.0/debug_token?input_token=<token>GET /v19.0/me/whatsapp_business_accountsGET /v19.0/<waba_id>/phone_numbersGET /v19.0/<phone_number_id>?fields=id,display_phone_number,code_verification_status,throughput,platform_type
UNO_BASE="https://uno.yourdomain.com"
TOKEN="client_token"
curl -sS "$UNO_BASE/v19.0/oauth/access_token?client_id=x&client_secret=y&code=test-code"
curl -sS -H "Authorization: Bearer $TOKEN" \
"$UNO_BASE/v19.0/debug_token?input_token=$TOKEN"
curl -sS -H "Authorization: Bearer $TOKEN" \
"$UNO_BASE/v19.0/me/whatsapp_business_accounts"-
subscribed_appsendpoints are compatibility no-op by design (return success). -
phoneNumberIdlegacy behavior is preserved. - Use
/sessions/meta/mappingsfor support visibility of resolved IDs.