Paramclasses Academy - Blog

Tutorials Details

←
Post 13 of 20
→

WhatsApp Cloud API Tutorial: Send Your First Message Step by Step

WhatsApp Cloud API Tutorial: Send Your First Message Step by Step

November 27, 2026

WhatsApp Cloud API Tutorial: Send Your First Message

Introduction

Businesses today want to communicate with customers quickly and efficiently. Whether it is an order confirmation, appointment reminder, course announcement, or customer support message, WhatsApp has become an important communication channel.

But how can a website or business application send WhatsApp messages automatically?

The answer is the WhatsApp Cloud API.

WhatsApp Cloud API allows developers to connect business applications with the WhatsApp Business Platform. Instead of manually opening WhatsApp and typing every message, developers can send messages programmatically through API requests.

For example, imagine an educational institute wants to send a confirmation message whenever a student registers for a course. Its website can communicate with WhatsApp Cloud API and automatically send the confirmation to the student's WhatsApp number.

In this beginner-friendly tutorial by Param Classes, we will understand WhatsApp Cloud API, configure a test environment, collect API credentials, send our first WhatsApp message, and understand common errors.

1. What Is WhatsApp Cloud API?

WhatsApp Cloud API is an official, cloud-hosted messaging API provided by Meta as part of the WhatsApp Business Platform.

It allows developers to integrate WhatsApp messaging into:

  • Websites and web applications.

  • Customer relationship management (CRM) systems.

  • E-commerce applications.

  • Educational management systems.

  • Appointment booking applications.

  • Customer support platforms.

  • Automated notification systems.

Developers send HTTP requests to Meta's Graph API. Meta processes these requests and handles message delivery through the WhatsApp platform.

Example:

Suppose an online store receives an order from a customer.

The application can automatically send:

"Hello Rahul! Your order has been confirmed. Thank you for shopping with us."

This process can happen without an employee manually typing the message.

2. How Does WhatsApp Cloud API Work?

Before writing code, understand the basic communication process.

  1. A business creates a Meta developer application.

  2. The WhatsApp product is configured inside the application.

  3. The developer obtains an access token and Phone Number ID.

  4. The website or backend sends an API request to Meta.

  5. Meta processes the request.

  6. The message is delivered to the recipient when the request and messaging conditions are valid.

  7. The application can use webhooks to receive message status updates and incoming messages.

Simple workflow:

Business Website → Backend Application → WhatsApp Cloud API → Meta Servers → Customer's WhatsApp

The API is useful because businesses can connect their existing software with WhatsApp instead of managing every conversation manually.

3. Requirements Before Starting

Before creating your first integration, prepare the following:

1. Meta Account

You need an account that can access Meta for Developers and manage the required business assets.

2. Meta Developer Application

This application provides the environment where you configure WhatsApp and manage API access.

3. WhatsApp Business Account (WABA)

A WhatsApp Business Account is used to manage the business's WhatsApp messaging assets.

4. Phone Number

For initial testing, Meta provides a test business phone number in the setup flow. For production, configure an eligible business phone number.

5. Access Token

An access token authorizes your application to make API requests.

6. Phone Number ID

This is the identifier of the business phone number used in the API endpoint. It is not the same as the visible phone number.

7. Test Recipient Number

Add and verify an eligible recipient number in the test setup before sending your first test message.

4. Create a Meta Developer Application

Follow these steps to create your developer application.

Step 1: Open Meta for Developers

Visit:

https://developers.facebook.com/

Log in using your Meta account.

Step 2: Open the App Dashboard

Navigate to the application dashboard and choose the option to create a new application.

Step 3: Create Your Application

Follow the available creation flow and provide the requested application details, including its name and contact information.

Choose the application type and business association according to your intended use case and the options currently displayed by Meta.

Step 4: Add the WhatsApp Product

After creating the application:

  1. Open the application dashboard.

  2. Find the option to add products.

  3. Select WhatsApp.

  4. Follow the setup instructions.

  5. Open the WhatsApp API setup or Getting Started section.

You should now have access to the WhatsApp configuration environment.

5. Configure WhatsApp Cloud API

After adding the WhatsApp product, open the API setup section.

Meta provides the configuration details required to send a test message.

You generally need to identify:

  • Temporary Access Token.

  • Test Business Phone Number.

  • Phone Number ID.

  • WhatsApp Business Account ID.

  • Supported Graph API version.

  • Eligible test recipient number.

Important: A temporary access token is useful for learning and initial testing, but it is not a suitable long-term production credential. For a production application, configure an appropriately authorized system user access token and required permissions.

Also, do not share your access token publicly or place it inside frontend JavaScript.

6. Understand the WhatsApp Cloud API Endpoint

WhatsApp Cloud API uses the Graph API to send messages.

The general endpoint is:

POST https://graph.facebook.com/vXX.X/PHONE_NUMBER_ID/messages

Understand the important parts:

  • POST: Sends data to the API.

  • graph.facebook.com: Meta's Graph API host.

  • vXX.X: Replace this with a currently supported Graph API version.

  • PHONE_NUMBER_ID: Replace this with your actual business Phone Number ID.

  • messages: The endpoint used to send messages.

The API version can change over time, so always check Meta's current documentation before publishing or deploying your integration.

7. Send Your First WhatsApp Message Using cURL

Now let's send a simple text message using an API request.

Open a terminal that supports cURL and prepare your API credentials.

Use the following example:

curl -X POST \
  "https://graph.facebook.com/vXX.X/PHONE_NUMBER_ID/messages" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "919876543210",
    "type": "text",
    "text": {
      "body": "Hello! This is my first WhatsApp Cloud API message."
    }
  }'

Replace the placeholders:

  • vXX.X with your currently supported Graph API version.

  • PHONE_NUMBER_ID with your actual Phone Number ID.

  • YOUR_ACCESS_TOKEN with your valid access token.

  • 919876543210 with an eligible test recipient number in the required international format.

Use the recipient number that you have added and verified in the test setup.

What does this request do?

  1. Connects to Meta's Graph API.

  2. Authenticates the request using the access token.

  3. Identifies the recipient.

  4. Defines the message type as text.

  5. Sends the message body to the API.

If the request is accepted, Meta normally returns a JSON response containing a message identifier.

8. Understand the API Response

After sending the request, the API returns a response.

A successful response may look similar to this:

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "919876543210",
      "wa_id": "919876543210"
    }
  ],
  "messages": [
    {
      "id": "wamid.EXAMPLE_MESSAGE_ID"
    }
  ]
}

This is an illustrative response. Actual values will depend on your request.

Important response fields:

messaging_product: Identifies the messaging product.

contacts: Contains recipient information returned by the API.

wa_id: Identifies the WhatsApp recipient.

messages.id: Provides the message identifier, commonly called the WhatsApp Message ID or WAMID.

Remember: An accepted API request does not automatically mean the message has been delivered or read. Use webhook status updates to track its progress.

9. Test Your First Message

After executing the request, check the following:

  1. Did the terminal return a successful API response?

  2. Does the response contain a message ID?

  3. Is the recipient number eligible for testing?

  4. Did the message arrive in the recipient's WhatsApp account?

  5. Are there any errors in the API response?

If the message arrives successfully, your first WhatsApp Cloud API test is complete.

You have now connected an application to Meta's messaging infrastructure and sent a message through an API request.

10. Important Difference: Test Messages and Production Messages

A test environment is designed to help developers understand API integration before connecting a real business workflow.

For production use, you should configure the required business assets, phone number, permissions, access token, messaging settings and applicable account requirements.

You should also understand the difference between:

Business-Initiated Messages

When a business starts a conversation outside the applicable customer service window, an approved message template is generally required, subject to Meta's current messaging rules.

Customer-Initiated Conversations

When a customer contacts the business, the business can respond under the applicable customer service window and messaging rules.

Always check the latest WhatsApp Business Platform policies before sending messages to customers.

11. Common WhatsApp Cloud API Errors and Solutions

Beginners may face different errors during their first API integration.

1. Invalid Access Token

Possible reasons:

  • Token has expired.

  • Token is incorrect.

  • Required permissions are missing.

Solution: Generate or configure a valid token with the required permissions.

2. Incorrect Phone Number ID

Possible reason: The visible business phone number was entered instead of its Phone Number ID.

Solution: Copy the correct identifier from the WhatsApp API setup or business configuration.

3. Recipient Number Not Eligible

Possible reason: The recipient has not been added or verified in the test setup.

Solution: Add the recipient through the available test configuration and complete the verification process.

4. Unsupported API Version

Possible reason: The request uses an unsupported Graph API version.

Solution: Check Meta's current Graph API version information and update the endpoint.

5. Message Not Delivered

Possible reasons include recipient restrictions, messaging policy requirements, invalid message content, or delivery issues.

Solution: Inspect the API response and webhook status events to identify the actual problem.

12. Real-World Example: Automatic Course Registration Confirmation

Imagine Param Classes has an online course registration website.

A student visits the website and registers for a Web Development course.

The application can follow this workflow:

  1. The student submits the registration form.

  2. The website stores the registration details.

  3. The backend prepares a WhatsApp notification.

  4. The backend sends the message through WhatsApp Cloud API.

  5. Meta processes the API request.

  6. The student receives the confirmation when delivery conditions are satisfied.

Example message:

"Hello Rahul! ????

Your registration for the Web Development course has been received successfully.

Our team will contact you with the next steps.

Thank you for choosing Param Classes!"

For an actual business-initiated notification, use the appropriate approved template whenever required by the current messaging rules.

This integration can reduce manual work and improve the registration experience.

13. Security Best Practices

API credentials must be handled carefully.

Follow these important practices:

  • Store access tokens in backend environment variables.

  • Never expose tokens in HTML, frontend JavaScript or public repositories.

  • Use the minimum permissions required.

  • Use an appropriately configured production access token.

  • Keep your server and dependencies updated.

  • Log API errors without exposing confidential credentials.

  • Validate recipient numbers before sending requests.

  • Follow Meta's messaging policies and customer consent requirements.

Security is especially important when connecting WhatsApp with customer databases, websites and CRM applications.

14. Frequently Asked Questions (FAQs)

Q1. What is WhatsApp Cloud API?

WhatsApp Cloud API is Meta's cloud-hosted API that allows businesses to integrate WhatsApp messaging with websites and software applications.

Q2. Is WhatsApp Cloud API free?

API access and message delivery costs are different considerations. Applicable charges depend on Meta's current pricing rules and the type of message. Check the latest official pricing information before launching.

Q3. Can beginners use WhatsApp Cloud API?

Yes. Beginners can start with Meta's test setup, understand the required credentials and send a test message using cURL or backend code.

Q4. What is a Phone Number ID?

It is a unique identifier for the business phone number used in API requests. It is different from the actual phone number customers see.

Q5. Can I send messages directly from JavaScript?

You should not expose your access token in browser-side JavaScript. Send API requests through a secure backend server.

Q6. What is a WhatsApp Message ID?

It is the unique identifier returned for a message accepted by the API. It can be used to correlate message status updates received through webhooks.

Q7. What should I learn after sending my first message?

The next step is learning how to configure webhooks so your application can receive incoming messages and message status updates.

Conclusion

WhatsApp Cloud API makes it possible to connect business applications with WhatsApp messaging through official APIs. Developers can use it to automate notifications, integrate websites, connect CRM systems and build customer communication workflows.

In this tutorial, we learned what WhatsApp Cloud API is, how to create a Meta developer application, configure the WhatsApp product, understand API credentials, send a text message using cURL, interpret the API response and troubleshoot common errors.

At Param Classes, our goal is to help learners understand practical technologies through beginner-friendly explanations and real-world examples.

Practise the test setup first. Once you understand how the API works, you can move towards backend integration, webhooks, automated notifications and complete WhatsApp business applications.

←
Post 13 of 20
→