
How to send WhatsApp message using WhatsApp Cloud API?
WhatsApp Cloud API is a powerful messaging solution that allows businesses to integrate WhatsApp messaging into their applications, enabling seamless communication with users on the popular platform. Unlike the traditional WhatsApp Business API, which requires hosting on a private server, the Cloud API is hosted on Meta’s infrastructure, making it easier to set up and manage.
Contents
Key Benefits of WhatsApp Cloud API
Before diving into how to send a message using the Cloud API, it’s essential to understand why businesses are opting for this solution.
- Scalability: Hosted on Meta’s cloud infrastructure, allowing seamless expansion.
- Cost-Effectiveness: Eliminates the need for hosting and server maintenance.
- Ease of Integration: Provides well-documented APIs for easy integration with business systems.
- Reliability: Operates on Meta’s secure and robust cloud network, ensuring high uptime.
Steps to Send a WhatsApp Message Using Cloud API
Step 1: Set Up a Meta Developer Account
To use the WhatsApp Cloud API, a Meta Developer Account is required. Businesses need to register as a developer and set up their business profile within Meta’s Business Manager.
Step 2: Create a WhatsApp Business App
In the Meta Developer Dashboard, users need to create a new app and add the WhatsApp product. This step provides access to the necessary API credentials, including the API key and access tokens.
Step 3: Generate an Access Token
Meta provides temporary and permanent access tokens. During the initial setup, a temporary access token is used, but businesses should generate a permanent token for long-term use. This token is required to authenticate requests.

Step 4: Get the Phone Number ID
Every WhatsApp Business account has a phone number ID, which is necessary for sending messages. This ID can be retrieved from the Meta for Developers dashboard under the “Phone Numbers” section.
Step 5: Make an API Request to Send a Message
Messages are sent by making a POST request to WhatsApp’s Cloud API endpoint. Below is an example of a request using cURL
:
curl -X POST 'https://graph.facebook.com/v17.0/{PHONE_NUMBER_ID}/messages' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "messaging_product": "whatsapp", "to": "RECIPIENT_PHONE_NUMBER", "type": "text", "text": { "body": "Hello, this is a test message from WhatsApp Cloud API!" } }'
Replace the placeholders:
- {PHONE_NUMBER_ID}: The Business Phone ID obtained in step 4.
- YOUR_ACCESS_TOKEN: The permanent access token generated earlier.
- RECIPIENT_PHONE_NUMBER: The destination WhatsApp number with the country code.
Step 6: Verify Message Delivery
If the request is successful, the API responds with a message ID, confirming that the message has been sent. Developers can use Webhooks to track delivery status in real-time.

Common Issues and Troubleshooting
While sending messages via the Cloud API is straightforward, users may encounter issues such as:
- Invalid Phone Number: Ensure the recipient’s number is formatted correctly, including the country code.
- Authentication Errors: Use a valid and non-expired access token.
- Permission Issues: Make sure the phone number is registered and associated with an approved WhatsApp Business Account.
FAQs
What is the difference between WhatsApp Cloud API and WhatsApp Business API?
WhatsApp Cloud API is hosted on Meta’s servers, eliminating the need for private hosting, whereas WhatsApp Business API requires businesses to set up their own server infrastructure.
Is WhatsApp Cloud API free?
Meta offers free access to the Cloud API, but businesses need to pay for the messages they send and receive, based on WhatsApp’s pricing model.
Do I need a phone to use WhatsApp Cloud API?
No, the Cloud API allows businesses to send messages without needing a physical phone, as messages are routed through Meta’s cloud infrastructure.
How can I get a permanent access token?
A permanent token can be generated using Meta’s Business Manager. Users need to set up an app and link the WhatsApp Business account to get a long-lived access token.
Can I send messages to users who haven’t interacted with my business?
No, businesses can only send messages to users who have opted in or have initiated a conversation with the business.
By following these steps, businesses can integrate the WhatsApp Cloud API into their communication strategy, allowing for efficient and automated messaging directly through WhatsApp.