🎉Elevate Your Salesforce Career with exclusive Data Cloud + Einstein Copilot Bootcamp Learn More! 🎉

🎉Elevate Your Salesforce Career with exclusive Data Cloud + Einstein Copilot Bootcamp Learn More! 🎉
How to Integrate Salesforce and WhatsApp

Send WhatsApp Message from Salesforce

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 https://developers.facebook.com and log in with your Facebook credentials. After login, go to My Apps and create a new app as shown below:

p1  

On the next screen, select App Type as Business:

p2

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

p3

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

p4

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

p5

  • 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:

p6

  • 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:

p7

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: https://graph.facebook.com/v14.0/<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.

Payload:

{ “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:

p8

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!

Frequently Asked Questions (FAQs)

1. What are the benefits of Salesforce WhatsApp integration?

  • Efficient Communication: It allows businesses to communicate directly with customers on a platform they’re familiar with, enhancing user experience and response rates.
  • Time-saving: The cloud-based version of the WhatsApp Business API can reduce integration time from several weeks to minutes, making it easier and quicker for smaller organizations to start.
  • Enhanced Customer-Centric Solutions: With seamless access to WhatsApp business cloud API, businesses can develop more solutions tailored to customer needs.
  • Global Reach: WhatsApp’s wide user base allows businesses to engage with customers globally.

2. What are the challenges of Salesforce WhatsApp integration?

  • Regional Pricing Variations: WhatsApp charges organizations based on per message, and prices aren’t consistent across every region.
  • The transition from Previous Systems: Organizations that used a Business API not based on the cloud before may find the shift challenging.
  • Verification Process: There is a need to verify phone numbers before sending messages, which may pose a bottleneck for rapid deployments.

3. Can Salesforce WhatsApp integration be customized to suit specific business needs?

Yes, Salesforce WhatsApp integration can be customized. Apart from using default templates like ‘Hello World’, businesses can edit or create their templates for messaging. Also, Salesforce’s LWC/Aura components allow for the creation of user interfaces tailored to specific business requirements.

4. Are there any best practices for successful Salesforce WhatsApp integration?

  • Ensure Proper Configuration: Before integrating, make sure to follow all configuration steps on the Facebook developer portal meticulously.
  • Test Before Full Deployment: Use the temporary access token to test the system and ensure messages are received correctly.
  • Understand the API: Familiarize yourself with the CURL request and associated WhatsApp API details before integrating.
  • Stay Updated: WhatsApp, being under Meta, is likely to evolve, so always stay updated with the latest changes and improvements.

5. Can I automate conversations using WhatsApp in Salesforce?

Yes, with the right development and utilization of bots or AI-driven tools, automating conversations should be feasible.

6. How much does Salesforce WhatsApp integration cost?

WhatsApp charges organizations on a per-message basis, with prices varying by region. For a detailed cost breakdown, it would be best to consult directly with WhatsApp or Salesforce representatives.

Table of Contents

Subscribe & Get Closer to Your Salesforce Dream Career!

Get tips from accomplished Salesforce professionals delivered directly to your inbox.

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

Unsure of Your Next Step?

Take our quick 60-second assessment to discover the Salesforce career path or learning journey that’s a perfect fit for you.

Related Articles

Humans of Salesforce – Shalini Mitra

Shalini Mitra’s inspiring journey from a developer to a tech lead in the Salesforce ecosystem, offering valuable insights and tips for aspiring trailblazers. Read now!

Salesforce Forecasting: The Ultimate Guide

Land more deals and achieve consistent revenue growth with Salesforce Forecasting! Equip your sales team to predict the future with confidence and accuracy.

Navigating Career Opportunities in Salesforce Data Cloud

Explore the evolving Salesforce Data Cloud career landscape, upskilling opportunities, and key roles driving data-driven transformation. Read now!