WhatsApp overview and architecture

What it is

3B WhatsApp is a native Salesforce managed package (namespace b3w) that connects an org to the WhatsApp Business Cloud API (Meta Graph API). It lets system admins message Contacts over WhatsApp and captures the whole conversation, inbound and outbound, on a custom object in Salesforce.

Messages can be sent from:

Inbound replies, media and delivery receipts arrive through a webhook that Meta calls, and are written back onto the message record, with an auto-match to the sending Contact.

Every part runs in Salesforce. Messages are stored on b3w__Whatsapp_Message__c, configuration is a Custom Metadata type, and the WhatsApp access token is held in a Salesforce External Credential so it is never in Apex or a browser.

How it works

Flow / Apex / WhatsApp Messager component
   |  (invocable actions)
   v
WhatsApp Business Cloud API, via the WhatsApp Named Credential
   |
   v
b3w__Whatsapp_Message__c   (Direction = Outbound, Status = Sent / Failed, wamid stored)

Meta --> /services/apexrest/whatsapp/webhook
           |- inbound messages  -> new inbound message records, auto-matched to a Contact
           |- delivery statuses -> update the matching outbound record
           |- inbound media     -> attached as a Salesforce File

Any message change -> WhatsApp_Message_Event__e -> WhatsApp Messager refreshes the conversation

Outbound flow

  1. A Flow action, Apex call or the WhatsApp Messager component sends one or more messages.
  2. The package loads the configuration for the sending number, resolves the destination phone, and builds the Cloud API request.
  3. The request is sent to graph.facebook.com/{version}/{phone-number-id}/messages through the WhatsApp Named Credential, which supplies the access token.
  4. A b3w__Whatsapp_Message__c record is written with Direction = Outbound, Status = Sent (or Failed), and the returned message id (wamid).

Sends from Flow and Apex run asynchronously and are bulk-safe.

Inbound flow

  1. Meta calls the webhook at /services/apexrest/whatsapp/webhook, both for the verification handshake when you configure it and for event pushes.
  2. The package processes the payload:
    • inbound messages become new records, auto-matched to a Contact by phone.
    • delivery statuses update the matching outbound record (correlated by wamid: Sent, Delivered, Read, or Failed).
    • inbound media is downloaded and attached as a Salesforce File.

Processing failures are logged to Log_Entry__c under the WhatsApp category.

Live conversation updates

Any insert or update on a message record publishes a WhatsApp_Message_Event__e platform event for the affected Contact. The WhatsApp Messager component subscribes over empApi and refreshes the open conversation in real time. You can subscribe to the same event in your own components or flows.