WhatsApp API Tutorial Developer Guide

How to Send WhatsApp Messages via API: A Developer Guide (2026)

By SendAPI Engineering · Last updated March 12, 2026 · 8 min read

A complete guide to integrating the WhatsApp Business API. Learn how to send template messages, notifications, and OTP codes programmatically using SendAPI.

What is the WhatsApp Business API?

The WhatsApp Business API (officially called WhatsApp Business Platform) lets you send messages to WhatsApp users programmatically — at scale, without the limitations of the consumer or small-business apps.

Unlike the free WhatsApp Business app (capped at 256 contacts per broadcast and manual operation), the API gives you:

  • No volume limits — send to millions of users
  • Programmatic control — trigger messages from your backend
  • CRM integrations — connect to Salesforce, HubSpot, or any custom system
  • Two-way conversations — receive and respond to inbound messages
  • Rich media support — images, documents, videos, interactive buttons

Why WhatsApp? The Numbers

WhatsApp is the world's most-used messaging app, with 2.78 billion monthly active users globally as of 2025 (Statista). In markets outside North America — including Latin America, Europe, India, and Southeast Asia — WhatsApp is the dominant communication channel. According to Meta's 2024 Business Messaging Report, more than 500 million businesses use WhatsApp for customer communication, and 45% of consumers in those markets prefer WhatsApp over email or SMS for customer service interactions.

For developers, that reach translates directly into higher engagement: WhatsApp messages have an average open rate of 98% compared to 20% for email (Statista, 2025). Delivered to a channel users check dozens of times per day, transactional messages sent via the WhatsApp Business API consistently outperform email and SMS for time-sensitive notifications.

Prerequisites

Before you can send your first message, you need:

  1. A Meta Business Manager account — free to create at business.facebook.com
  2. A verified business — Meta requires basic business verification
  3. A WhatsApp Business API provider — SendAPI is an official Meta Business Solution Provider (BSP) and handles the technical setup for you

Step 1: Get Your API Key

Sign up at sendapi.co/register and create your first project. You'll get an API key immediately — no waiting for approval at this stage.

Step 2: Connect Your WhatsApp Number

In the SendAPI dashboard, go to WhatsApp → Sessions and follow the on-screen flow to:

  1. Link your Meta Business Manager
  2. Add and verify a phone number (can't be an active consumer WhatsApp number)
  3. Create your first message template

Template approval from Meta typically takes a few minutes for standard categories (authentication, utility) and up to 24 hours for marketing templates.

Step 3: Send Your First Message

Once your template is approved, you can send it via the API:

curl -X POST https://api.sendapi.co/v1/whatsapp/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+14155552671",
    "type": "template",
    "template": {
      "name": "order_confirmation",
      "language": "en_US",
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "John" },
            { "type": "text", "text": "ORD-9271" }
          ]
        }
      ]
    }
  }'

A successful response looks like:

{
  "success": true,
  "message_id": "wamid.HBgLMTQxNTU1NTI2NzEVAgARGBI3RkY...",
  "status": "sent"
}

Message Types

Template Messages (anytime)

Template messages are pre-approved message formats you can send to any user, even outside the 24-hour window. There are three categories:

| Category | Use case | Example |

|---|---|---|

| Authentication | OTP codes | "Your code is 847291" |

| Utility | Transactional | "Your order has shipped" |

| Marketing | Promotional | "25% off this weekend only" |

Free-form Messages (within 24 hours)

If a user messages you first, you have a 24-hour window to reply with any content — no template required. This is the "customer service window" and allows rich, conversational messages.

Handling Inbound Messages

Set up a webhook in your SendAPI dashboard to receive incoming messages:

// Node.js / Express example
app.post('/webhook/whatsapp', (req, res) => {
  const { from, type, text } = req.body

  if (type === 'text') {
    console.log(`Message from ${from}: ${text.body}`)
    // Route to your support system, bot, or CRM
  }

  res.sendStatus(200)
})

Going to Production Checklist

  • [ ] Business verified with Meta
  • [ ] Phone number not used on consumer WhatsApp
  • [ ] Templates approved in the relevant categories
  • [ ] Webhook endpoint live and handling events
  • [ ] Idempotency keys set on all send requests (prevents duplicate messages on retry)
  • [ ] Rate limits understood (varies by tier and template category)

Next Steps