Official WhatsApp Business Messaging
BrokerOS connects directly to Meta WhatsApp Cloud API v22.0, bypassing unverified third-party scrapers or brittle QR-code gateways. Official Cloud API integration guarantees enterprise reliability, verified badge support, 24-hour service conversation windows, pre-approved marketing templates, and cryptographic delivery tracking. All WhatsApp communication logic is decoupled into the@brokeros/int-whatsapp integration adapter, while the NestJS backend (apps/api/src/marketing/whatsapp/) orchestrates team inbox threads, AI reply synthesis, broadcast queues, and inbound webhook processing.
Architecture & Integration Pipeline
Required Credentials & Parameters
To link your WhatsApp Business Account (WABA) with BrokerOS, retrieve the following values from your Meta Business Manager and Meta Developer accounts:Step-by-Step Configuration Guide
1
Create a Meta Business App
- Log in to the Meta for Developers Portal.
- Click My Apps and then Create App.
- Choose Other as the use case, click Next, and select Business as the app type.
- Provide an app display name (e.g., Skyline Realty CRM) and link it to your primary Meta Business Portfolio.
- On the App Dashboard, scroll down to Add products to your app and click Set up on the WhatsApp tile.
2
Locate Phone Number ID and WABA ID
- In the left-hand navigation of your Meta App, expand WhatsApp and click API Setup.
- Under Step 1: Select phone numbers, locate your live WhatsApp phone number.
- Copy the Phone number ID displayed directly below the phone number dropdown.
- Copy the WhatsApp Business Account ID displayed below the Phone number ID.
3
Generate a Permanent System User Token
Temporary access tokens from the API Setup screen expire within 24 hours. To generate a permanent production token:
- Open Meta Business Settings.
- In the left sidebar, navigate to Users -> System Users.
- Click Add, name the system user (e.g.,
BrokerOS System User), and assign the Admin role. - Click Assign Assets, select WhatsApp Accounts, select your WABA, and toggle on Full control (Manage WhatsApp Business Account). Save changes.
- Click Generate New Token, choose your Meta Business App from the dropdown, and set token expiration to Never.
- In the permissions list, check the following required scopes:
whatsapp_business_messaging(send and receive messages)whatsapp_business_management(read templates and phone number status)
- Click Generate Token and immediately copy the token string (
EAAB...).
4
Connect Account in BrokerOS Settings
In the BrokerOS web application:
- Navigate to Dashboard -> Marketing -> WhatsApp -> Settings (
/dashboard/marketing/whatsapp/settings). - Ensure the Meta WABA Account tab is selected.
- Enter your Phone Number ID, WhatsApp Business Account ID (WABA), and the System User Access Token.
- Click Connect Account (or Update Credentials):
- BrokerOS executes a pre-flight request to
GET https://graph.facebook.com/v22.0/{phoneNumberId}to verify credential validity. - The system automatically triggers
POST https://graph.facebook.com/v22.0/{wabaId}/subscribed_appsto subscribe your WABA to app webhooks. - Credentials are encrypted using AES-256-GCM and saved in PostgreSQL (
WhatsAppBusinessAccount). - Upon success, the card displays your verified business name, phone number, and quality rating (e.g.,
GREEN).
- BrokerOS executes a pre-flight request to
5
Configure Meta Webhook and Subscriptions
To receive customer messages, button clicks, and delivery receipts in real time:
- In BrokerOS, switch to the Webhook & Diagnostics tab (
/dashboard/marketing/whatsapp/settings?tab=webhook). - Copy the Meta Webhook Callback URL:
- Copy the displayed Verification Token (or configure your own custom token).
- In the Meta Developer Portal, navigate to WhatsApp -> Configuration -> Webhook and click Edit.
- Paste the Callback URL and Verify Token, then click Verify and Save. BrokerOS verifies the
hub.challengehandshake instantly. - Under Webhook fields, click Manage and subscribe to:
messages(inbound customer text, button responses, and attachments)message_template_status_update(template approvals and rejections)
Meta Graph API v22.0 Integration Contract
The@brokeros/int-whatsapp package encapsulates all direct communication with Meta Graph API endpoints:
Security Model: Encryption & Webhook Verification
BrokerOS protects WhatsApp communications and credentials using multi-layered enterprise safeguards:- At-Rest AES-256-GCM Encryption: System User Access Tokens are encrypted with an initialization vector (IV) and authentication tag prior to database storage in
packages/prisma/schema.prisma. Plaintext access tokens are never written to disk or logs. - In-Transit Webhook Integrity: Inbound webhooks from Meta are validated against the
x-hub-signature-256header. The server computes an HMAC-SHA256 signature using your Meta App Secret to ensure payloads originate exclusively from Meta servers. - SSRF Guard: Media URLs and dynamic asset links undergo strict Server-Side Request Forgery validation (
ssrf-guard.ts) to prevent internal network probing. - Zero Downtime Updates: Modifying access tokens or phone number mappings through the settings interface takes effect immediately across all workers without requiring server restarts.