Category:Whatsapp Integration
Native Salesforce integration with the WhatsApp Business Cloud API (Meta Graph API). System admins can send freehand text, template, and media messages to Contacts from Screen Flows, Record-Triggered Flows, Scheduled Flows, or Apex, and receive inbound replies + delivery statuses via a webhook. Modelled on the n8n "WhatsApp Business Cloud" node. Ships inside the b3w managed package.
One-time setup (per org / post-install)
- Meta side: create a WhatsApp Business Account (WABA), add one or more phone numbers, and create a System User access token with
whatsapp_business_messaging+whatsapp_business_managementscopes. - External Credential token: Setup → Named Credentials → External Credentials → WhatsApp → edit the WhatsAppPrincipal named principal → add authentication parameter Access_Token = your access token. Grant the running users/perm set access to the principal.
- Custom Metadata: create one WhatsApp Configuration record per phone number:
WhatsApp Business Account Id— the WABA idPhone Number Id— the phone number id (not the display number)Display Phone Number— e.g.+1 555 000 0000Named Credential—WhatsAppAPI Version— e.g.v21.0Webhook Verify Token— any secret string (also entered in Meta, see below)Is Default— check on exactly one record
- Permission set: assign
WhatsApp Adminto the relevant users. - Webhook: in Meta → WhatsApp → Configuration → Webhooks, set
- Callback URL:
https://<your-domain>/services/apexrest/whatsapp/webhook - Verify token: the same string as
Webhook Verify Token - Subscribe to the messages field. (The Salesforce site/community hosting
/services/apexrestmust allow guest access to the REST resource.)
- Callback URL:
Sending from Flow
Send WhatsApp Text
| Input | Notes |
|---|---|
| Contact Id | Optional — links the record; phone taken from Mobile/Phone if no number supplied. |
| To Phone Number | Optional — overrides Contact phone. Country code required (e.g. +447700900123).
|
| Message Body | Required. |
| Configuration Name | Optional — DeveloperName of the sending number; blank = default. |
Send WhatsApp Template
Same Contact/phone/config inputs, plus:
| Input | Notes |
|---|---|
| Template Name | Required. Use Get WhatsApp Templates to list approved names. |
| Language Code | Defaults to en_US.
|
| Body Parameters | Ordered text values for {{1}}, {{2}}, ….
|
| Button URL Parameter | Dynamic suffix for a URL button (button index 0), if the template has one. |
Send WhatsApp Media
Same Contact/phone/config inputs, plus Media Type (Image/Document/Video/Audio), Media URL (public HTTPS), and optional Caption.
Get WhatsApp Templates
Returns a Template Names collection for the configuration — bind it to a dynamic choice in a Screen Flow so admins pick a template instead of typing it. Makes a synchronous callout; use in Screen Flows (not record-triggered flows, which can't call out synchronously).
From Apex
WhatsAppSendText.Request r = new WhatsAppSendText.Request();
r.contactId = someContactId;
r.messageBody = 'Hi there';
WhatsAppSendText.send(new List<WhatsAppSendText.Request>{ r });
The Whatsapp_Message__c object
| Field | Type | Notes |
|---|---|---|
Contact__c
|
Lookup(Contact) | Auto-matched for inbound; blank if no/ambiguous match — resolve manually. |
Direction__c
|
Picklist | Inbound / Outbound |
Message_Body__c
|
Long Text (131072) | Message text or media caption. |
Message_Type__c
|
Picklist | Text / Template / Image / Document / Video / Audio / Other |
Status__c
|
Picklist | Queued / Sent / Delivered / Read / Failed / Received |
WhatsApp_Message_Id__c
|
Text (External Id) | The wamid — correlates delivery statuses.
|
From_Phone_Number__c / To_Phone_Number__c
|
Text | |
Phone_Number_Id__c
|
Text | Sending/receiving number id. |
Template_Name__c
|
Text | |
Media_Id__c
|
Text | Inbound/outbound media id. |
Error_Message__c
|
Long Text | API/processing error detail. |
Sent_Received_DateTime__c
|
DateTime |
Inbound media is downloaded asynchronously and attached as a Salesforce File (ContentVersion) on the message record.
Pages in category ‘Whatsapp Integration’
This category contains only the following page.