العربية

WhatsApp API integration for your website: the official way, step by step

A WhatsApp button and a real WhatsApp API integration are different things. What you need, how the official Cloud API works, and the mistakes that get numbers blocked.

· 4 min read
WhatsApp API integration for your website: the official way, step by step

In much of the Middle East, customers answer WhatsApp long before they open an email. That is why WhatsApp API integration is one of the first things business owners ask about: order confirmations, tickets, appointment reminders and automatic replies, all sent by the website itself.

Before you start, know that a WhatsApp button and a real API integration are very different, and that popular unofficial shortcuts can get your number banned. This guide covers the official route, based on platforms I have built that connect WhatsApp to booking and event systems.

WhatsApp button or WhatsApp API integration?

A WhatsApp button (a wa.me link) opens a chat with your number. You reply by hand from your phone. It is free and fine for low volume.

A WhatsApp API integration lets your system send and receive messages:

  • Send the order confirmation or ticket automatically after payment.
  • Remind customers of their appointment the day before.
  • Save incoming messages in your dashboard, or let an AI assistant answer them.
  • Let several staff members reply from one number.

If you have volume or want automation, you need the API.

The official way: Meta's WhatsApp Cloud API

WhatsApp's official API is part of the WhatsApp Business Platform, offered through Meta for Developers as the Cloud API. You can use it directly, or through an approved Business Solution Provider (BSP) that gives you a ready dashboard for a subscription.

Unofficial tools that run WhatsApp Web in the background and send from it break WhatsApp's terms, and the number can be banned at any moment. Don't build your business on them.

What you need before integrating the WhatsApp API

  1. A Meta business portfolio, ideally verified with your company details.
  2. A phone number dedicated to the API. A number connected to the API can't be used the same way in the regular WhatsApp app at the same time.
  3. An app in Meta for Developers linked to the business portfolio, with the WhatsApp product added.
  4. A server that receives notifications (a webhook) and sends messages.

How the integration works

Sending messages

Your server sends an HTTPS request to the WhatsApp API with the customer's number and the message. For example, after a payment succeeds, the backend sends the order number. The access token stays on the server only and never appears in code that visitors can see.

// Node.js 18+: send a template message (values are placeholders)
await fetch(`https://graph.facebook.com/${API_VERSION}/${PHONE_NUMBER_ID}/messages`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.WA_TOKEN}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    messaging_product: 'whatsapp',
    to: '9665XXXXXXXX',
    type: 'template',
    template: { name: 'order_confirmed', language: { code: 'en' } },
  }),
});

Use the API version shown in your Meta app dashboard.

Receiving messages (webhook)

When the customer replies, WhatsApp sends the message to a URL on your server. Your system stores it, shows it to staff, or passes it to an AI assistant. Verify that each request really comes from Meta by checking the signature header sent with every notification.

Templates and the 24-hour window

This is the rule that matters most:

  • When a customer messages you, a 24-hour window opens where you can reply freely.
  • Outside that window, or when you start the conversation, you must use a message template that WhatsApp approved in advance.

So messages like "Your booking is confirmed" or "Your appointment is tomorrow at 5" must be prepared as templates and approved before launch.

Mistakes that block numbers or lower quality

  • Messaging people who didn't opt in. Collect consent, for example a checkbox on the order form.
  • Too much marketing. If people block or report you, your quality rating drops and WhatsApp limits how many messages you can send.
  • Vague templates that don't say who is sending and why.

Cost

Meta charges per message by category (marketing, utility, authentication) and by country, and prices change, so check Meta's official pricing page before you budget. Add the cost of building the integration, and a BSP subscription if you use one.

What you can build on top

Once WhatsApp is connected to your system, you can add an AI assistant that answers common questions and hands the chat to a person when needed, and connect messages to bookings or tickets. I describe this kind of work on the WhatsApp business and AI integration page. For event systems, see also event ticketing platform features.

FAQ

Is WhatsApp API integration free?

No. Meta charges per message by category and recipient country, and the integration itself takes development work. Only the plain WhatsApp button is free.

Can I use my current WhatsApp number?

Usually yes, but the number moves to the API and stops working the same way in the regular app. Many businesses use a new number for the API.

What is the difference between the WhatsApp Business app and the WhatsApp API?

The Business app is for manual replies from a phone. The API lets your system send and receive automatically, with several staff and connections to your other systems.


Want WhatsApp connected to your website or system? Talk to the editor at ahmed-adil.com.

More from the Supplement