SaasGuru Logo

Send WhatsApp Message from Salesforce

Table of Contents

How to Integrate Salesforce and WhatsApp

WhatsApp did a global launch of the Cloud API. WhatsApp is swiftly pushing itself into the cloud market by launching the WhatsApp Cloud API for all businesses globally. It was introduced into beta testing in November of last year. 

The new tool is a cloud-based version of the WhatsApp Business API- WhatsApp’s first revenue-creating enterprise product. And the tool is built on the parent company Meta’s infrastructure.

WhatsApp charges organizations based on per message because prices are not similar in every region and for multiple messages. Until last year, many organizations opted for a Business API that was not cloud-based. These organizations also include some of the leading global companies.

Become a Salesforce Certified Professional

Use Coupon Code BLOG20 to avail flat 20% discount on saasguru Programs.

The cloud-based version, according to WhatsApp, targets the market of smaller organizations and cuts integration time from several weeks to only minutes. Additionally, it stated that it was free.

In this article, we have picked the most basic use case for sending WhatsApp messages from Salesforce using WhatsApp API.

WhatsApp Configuration Steps

First, you need to do the configuration on the Facebook developer portal. Follow the below steps to complete the WhatsApp configuration: 

Open and log in with your Facebook credentials. After login, go to My Apps and create a new app as shown below:


On the next screen, select App Type as Business:

On the next screen, provide the basic details and click Create App:

On the next page, click on Set Up under WhatsApp product:

Then leave everything default and click Continue. You will see all the details on the next screen:

  • Temporary access token, which is valid for 23 hours by default. 
  • From number is the test number generated automatically. This is the number from which you will receive messages.
  • You have to enter and verify the recipient number in the To. You will receive a confirmation code on WhatsApp as shown below:

  • Enter the confirmation code to verify your number. You can add up to 5 numbers with this free tier access.
  • In the Step 2 section, you will get a CURL request to send a WhatsApp message to the verified number in the previous step. It can be used in Apex or Postman.
  • You can select your number in the To dropdown and then click on Send Message button to receive the hello world template message as shown below:

Understanding the API

Let’s understand the CURL request and associated WhatsApp API in detail. WhatsApp Cloud API uses Meta’s Graph API for integration.

Endpoint:<phone number id>/messages

Here is the endpoint provided by Facebook to send WhatsApp messages. You must pass the <phone number id> from the app setting page to ensure the message is sent to the verified number.


{ “messaging_product “: “whatsapp “,

  “to “: “<phone_number>”,

  “type “: “template “,

  “template “: {

    “name “: “hello_world “,

    “language “: {

      “code “: “en_US ” }}}

The endpoint expects the above payload (using templates) to send messages to your number successfully. By default ‘Hello World’ template is configured. You can edit or create your template by clicking on the link above the CURL request.

To send message text without using templates, you can use below payload format:

    “messaging_product”: “whatsapp”,
    “to”: ” <phone_number> “,
    “text”: {“body” : “hi”}

When you make the API callout, you will get the below response:

The message id is an encrypted value of the message that is sent. It is an identifier of the sent message.

Salesforce Configuration

You can develop automation or use the LWC/Aura component to develop a user interface in Salesforce to send messages by taking user inputs.

Get your Salesforce Certifications on the first go

Use Coupon Code BLOG20 to avail flat 20% discount on saasguru Programs.

At the Salesforce end, you only need to add the endpoint to the remote site setting (Setup->Remote Site Setting). Then you can create an LWC component and an Apex class. You can make the HTTP callout in Apex using the details from the CURL request. 

Summing Up

The global launch of WhatsApp business cloud API has allowed businesses to access their APIs seamlessly and easily develop more customer-centric solutions. It will enable less hassle to access cloud API compared to the on-premise setup of SDKs.

To get your doubts clarified by seasoned Salesforce professionals, join our Salesforce Slack account or get the latest updates from saasguru by joining saasguru. 

Sign up, Now!

Looking for Career Upgrade?

Book a free counselling session with our Course Advisor.

By providing your contact details, you agree to our Terms of use & Privacy Policy

Related Articles

AWS Solution Architect Associate Certification Cost in India

Paying up for AWS Solution Architect Associate Certification cost in India is a clever move to get to the top of the demand in the job market. Learn more!

AWS Cloud Practitioner Salary in the USA

This salary by AWS is also one of the top salaries drawn by AWS Cloud Practitioners in the USA. Learn more!

Sharing and Visibility Architect Dumps – Is It Worth?

Are Salesforce Sharing and Visibility Architect dumps worth it? Learn why you should stay away from exam dumps in this blog. Read Now!

Scroll to Top