Back
Complete Guide

WhatsApp Business API - Complete Beginner Guide

Everything you need to know to start using the WhatsApp Business API to send/receive messages and run ads that open WhatsApp chats.

WhatsApp Business API Guide

What is WhatsApp Business API?

WhatsApp Business API (now part of Meta Business Platform) allows businesses to communicate with customers at scale. It provides powerful features for modern business communication.

  • Send messages to customers at scale
  • Receive and reply to messages
  • Automate conversations using chatbots
  • Send notifications (OTP, order updates, etc.)
  • Run Click-to-WhatsApp Ads

Requirements Before You Start

You need the following to get started with WhatsApp Business API:

  1. Facebook (Meta) Business Account
  2. Verified Business (recommended)
  3. Phone number (NOT used on WhatsApp before)
  4. Website (recommended for approval)
  5. Basic programming knowledge (PHP, Node.js, or Python)

Choose Your Setup Method

There are TWO ways to use the API:

Option A: Official WhatsApp Cloud API (Recommended)

  • Hosted by Meta
  • No server setup required
  • Free tier available

Option B: WhatsApp Business API via BSP (Business Solution Provider)

  • Providers: Twilio, 360dialog, MessageBird
  • Easier UI, but paid
  • Additional features and support

Setup WhatsApp Cloud API (Step-by-Step)

Step 1: Create App

  1. Go to Meta Developers
  2. Click "Create App"
  3. Choose "Business"
  4. Add "WhatsApp" product

Step 2: Get API Credentials

  • Access Token
  • Phone Number ID
  • WhatsApp Business Account ID

Step 3: Add Phone Number

Verify your number via SMS or call. Make sure the number has never been used on WhatsApp before.

Step 4: Setup Webhook (IMPORTANT)

Configure your webhook URL and verify token:

Your server endpoint will receive incoming messages and status updates.

Send Your First Message (API)

Use the following endpoint to send messages:

POST https://graph.facebook.com/v18.0/PHONE_NUMBER_ID/messages

You can send text messages, images, videos, documents, and interactive messages using this endpoint.

Receive Messages (Webhook)

When a user sends a message, WhatsApp sends a POST request to your webhook URL with the message data.

Parse the incoming JSON to extract the message content and sender information.

Message Types You Can Send

  • Text messages
  • Images
  • Videos
  • Documents
  • Location
  • Buttons (interactive)
  • List messages

WhatsApp Message Templates

Templates are required for sending messages outside the 24-hour window. Go to Meta Business Manager, create a template, and submit it for approval.

Example: "Hello {{1}}, your order is ready" - Templates can include variables for personalization.

The 24-Hour Rule

Understanding the conversation window is crucial:

  • You can reply freely within 24 hours of user message
  • After 24 hours, you must use a template message

WhatsApp Ads (Click-to-WhatsApp)

Click-to-WhatsApp Ads on Facebook and Instagram open WhatsApp chats directly. This is a powerful way to generate leads and start conversations.

Create campaigns in Ads Manager with "Messages" objective and choose WhatsApp as the destination.

Automation (Chatbots)

Build intelligent chatbots using PHP, Node.js, or Python. Automate responses to common questions and create conversation flows.

Example: If a message contains "price", automatically send pricing information.

Pricing

  • Free tier (limited conversations)
  • Paid per conversation after limit
  • Categories: Marketing, Utility, Authentication

Best Practices

  • Always get user consent before messaging
  • Avoid spam and respect user preferences
  • Use templates correctly and get them approved
  • Respond quickly to maintain engagement
  • Personalize messages for better results

Common Errors

  • Invalid token - Check your access token
  • Phone not verified - Complete verification
  • Template not approved - Wait for Meta approval
  • User not opted-in - Get consent first

Useful Tools

  • Postman (API testing)
  • ngrok (local webhook testing)

Architecture Example

Frontend (Website) → Backend (PHP API) → WhatsApp Cloud API → User Device

Next Steps

  • Build a chatbot
  • Integrate with your CRM
  • Use AI (ChatGPT) for smart responses
  • Add analytics and tracking

Conclusion

WhatsApp Business API is powerful for customer communication, automation, and marketing. Start with Cloud API, test messages, then scale with automation and ads.

Ready to Get Started?

Start using WhatsApp Business API today and transform your customer communication.

Get Started Now