vCX WhatsApp Onboarding & Messaging
Base URL - Administration
https://backend.admin.versalence.online/api/v2
All protected endpoints require:
Authorization: Bearer <JWT_TOKEN>
1. Authenticate the customer admin
The customer’s admin user logs in with their vCX credentials. The returned JWT is used for all subsequent calls.
POST /api/v2/login
Content-Type: application/json
{
"email": "admin@customer.com",
"password": "CustomerAdminPassword"
}
Response:
{
"success": true,
"message "Sign-in successful",
"token": "<JWT_TOKEN>"
}
Notes:
- The user must have
email_verified = 'yes'. - The account must be
active. - The JWT expiry is controlled by the server (
JWT_EXPIRES_IN).
2. Get Agency Customers
GET /api/admin/v2/getCustomers
Authorization: Bearer <agency-jwt>
Response:
{
"success": true,
"message": "Customers retrieved successfully.",
"data": [
{
"uuid": "...",
"company_name": "...",
"company_email": "...",
"company_id": "AGTSW000012026",
"account_status": "active",
"parent_agency_uuid": "...",
"company_member_since": "...",
"user_name": "...",
"user_email": "...",
"user_phone": "...",
"user_role": "admin",
"user_status": "active"
}
]
}
2. Login to Sub Account using company_id
GET /api/admin/v2/clientAgentLogin&client_id=<SUB_ACCOUNT_COMPANY_ID>
Authorization: Bearer <agency-owner-jwt>
How it works
- The agency owner logs in via
/api/admin/v2/adminLoginto get their own JWT. - They call
/api/admin/v2/clientAgentLogin&client_id=<company_id>with that JWT. - The backend validates that the requested account is actually a sub-account under the agency.
- It returns a JWT for the sub-account’s first admin user.
Example
GET /api/admin/v2/clientAgentLogin&client_id=AGTSW000012026
Authorization: Bearer <agency-owner-jwt>
Response:
{
"success": true,
"message": "User successfully logged in.",
"token": "<sub-account-jwt>"
}
Base URL- Backend
https://backend.versalence.online
All protected endpoints require:
Authorization: Bearer <JWT_TOKEN>
Check WhatsApp integration status
Use this to decide whether the customer still needs to onboardApp.
GET https://backend.versalence.online/api/v2/getWaba
Authorization: Bearer <JWT_TOKEN>
Not integrated response:
{
"success": true,
"message": "no whatsapp data found"
}
Already integrated response:
{
"success": true,
"message": "whatsapp data found",
"data": [
{
"app_id": "...",
"waba_id": "...",
"access_token": "[hidden]",
"phone_id": "...",
"phone_number": "919876543210",
"display_phone_number": "+91 98765 43210",
"onboarding_mode": "standard",
"is_active": true,
"webhook_status": "subscribed"
}
]
}
3. Launch Meta Embedded Signup
The mobile app initiates embedded signup **directly with Meta**, using vCX’s Meta App ID.
The typical sequence is:
### 1. Mobile app has vCX Meta App ID configured
This is a static config in the mobile app:
```javascript
const VCX_META_APP_ID = '931735171941134';
const VCX_GRAPH_API_VERSION = 'v20.0';
const REQUIRED_SCOPES = 'whatsapp_business_management';
```
The backend currently does **not** expose an endpoint to provide these values — they must be shared with the external developer as integration constants.
### 2. Mobile app launches Meta Embedded Signup
Using Meta’s Embedded Signup SDK or a WebView, the app loads:
```
https://www.facebook.com/v20.0/dialog/oauth?
client_id=<VCX_META_APP_ID>
&redirect_uri=<MOBILE_APP_REDIRECT_URI>
&scope=whatsapp_business_management
&response_type=code
```
### 3. User completes setup inside Meta
The user:
- Selects or creates a WhatsApp Business Account
- Selects the phone number
- Grants permission to vCX’s app
### 4. Meta redirects back with a code
Meta redirects to the mobile app redirect URI with:
```
<MOBILE_APP_REDIRECT_URI>?code=<META_AUTH_CODE>
```
### 5. Mobile app sends the code to vCX
```http
POST /api/v2/whatsappSign
Authorization: Bearer <vCX_JWT>
Content-Type: application/json
{
"code": "<META_AUTH_CODE>",
"mode": "coexistence"
}
```
Then continue with `/v2/whatsappWaba` and `/v2/whatsappPhone` using the `session_id`.
---
## Missing piece
There is currently **no vCX backend endpoint** that tells the mobile app:
- What is vCX’s Meta App ID
- What scopes to request
- What redirect URI to use
So those must be provided to the external developer out-of-band, or you can add a new endpoint like:
```http
GET /api/v2/whatsappSignupConfig
Authorization: Bearer <vCX_JWT>
```
which returns:
```json
{
"success": true,
"data": {
"app_id": "<APP_ID>",
"graph_api_version": "v20.0",
"scope": "whatsapp_business_management"
}
}
```
Do you want me to add that config endpoint, or will you share the Meta App ID directly with the external developer?
6. Complete WhatsApp onboarding on the vCX backend
Use the 3-step onboarding flow (recommended). It supports both standard and coexistence modes and keeps the access token server-side.
Step 6a — Exchange the Meta code for an access token
POST /api/v2/whatsappSign
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json
{
"code": "<META_AUTH_CODE>",
"": "coexistence"
}
Response:
{
"success": true,
"message": "Access token updated successfully",
"session_id": "<SESSION_ID>",
"mode": "coexistence",
"data":<ACCESS_TOKEN>"
}
Save session_id and discard data (legacy field).
Step 6b — Resolve WABA ID
POST /api/v2/whatsappWaba
Authorization: Bearer <JWT_TOKEN>
Content-Type:/json
{
"session_id": "<SESSION_ID>"
}
Response:
{
"success": true,
"message": "WABA ID updated successfully",
"data": {
"waba_id": "<WABA_ID },
"session_id": "<SESSION_ID>"
}
Step 6c — Resolve phone number and complete signup
POST /api/v2/whatsappPhone
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json
{
session_id": "<SESSION_ID>"
}
Response:
{
"success": true,
"message": "Whatsapp embedded signup complete with co-existence mode",
"mode": "coexistence",
"phone_number": "876543210",
"phone_id": "<PHONE_ID>",
"webhook_config": "Webhook configured successfully"
}
At this point the backend has:
- Registered the phone number with Meta.
- Configured the vCX webhook.
- Persisted WABA, phone ID, and access token.
- For Coexistence mode, requested history and app-state sync from Meta.
Role requirement: Admin only for all three steps.
7. Verify onboarding completed
Call the status endpoint again:
http GET /api/v2/getWaba Authorization: Bearer ```
Confirm is_active is true and webhook_subscription_status is subscribed.
8. Send messages via vCX
Once is complete, use the separately documented messaging API to send WhatsApp messages through the vCX platform.
The backend stores the access token and phone ID, so the send-message API only needs the vCX customer JWT (and the recipient/message payload---
Prerequisites
- The customer account must already exist in vCX (created as a sub-account under the partner’s master account via the admin/partner flow).
- The customer must have an admin user with verified email and active account status. 3 The mobile app must be able to launch Meta Embedded Signup using vCX’s Meta App ID.
- Coexistence mode must be enabled before the 3-step onboarding if that mode is desired.
Role requirements summary
| Endpoint | Required role|----------|---------------| | POST /v2/login | Any user | | GET /v2/getWaba | Any authenticated user | | GET /v2/whatsapp-coexistence/status | Admin | | POST /v/whatsapp-coexistence/enable | Admin | | POST /v2/whatsappSign | Admin | | POST /v2/whatsappWaba | Admin | | POST /v2/whatsappPhone | Admin |
Important notes
- Legacy endpoint
POST /api/v2/embeddedSignupexists as a single-call onboarding flow, but it always usesstandardmode** and does not support Coexistence. Use the 3-step flow above for Coexistence. - **Token storage The 3-step flow uses
session_idto keep the Meta access token server-side. The mobile app only needs to store the vCX JWT. - No login to vCX web UI required: The mobile app can perform the entire flow via these API calls.
Let me know if you want me to save this as a file in the repo (e.g., docs/mobile-app-whatsapp-integration.md).