Web Development · 3 min read

WhatsApp Business API Integration: A Developer’s Practical Guide

By Vedhin Technology ·

WhatsApp has 500 million users in India and is the primary communication channel for hundreds of millions of businesses. The WhatsApp Business API lets you send automated messages, order notifications, OTPs, and appointment reminders programmatically from your application. This guide covers practical integration details from our real client projects.

Three Tiers of WhatsApp Business

  • WhatsApp (personal): No API access. Manual only.
  • WhatsApp Business App: Free mobile app. Quick replies, catalogs, auto-responses. No application integration.
  • WhatsApp Business Platform (API): Programmatic access — integrate with your app, CRM, or e-commerce platform. Requires Meta Business verification and approved message templates.

Getting API Access: The Setup Process

Step 1: Create a Meta Business Manager account at business.facebook.com.

Step 2: Add a WhatsApp Business Account (WABA) with a dedicated phone number — cannot be registered with WhatsApp already.

Step 3: Business verification — submit GST certificate or company registration, business website, and business email. Takes 3–7 business days. Sole proprietors with GST registration qualify in India.

Step 4: Choose direct Cloud API (free, rate-limited) or a Business Solution Provider (BSP) like Interakt or AiSensy (India-based, INR billing, simpler onboarding). BSPs add cost but simplify compliance and template management.

Message Templates: The Core Concept

Business-initiated messages must use pre-approved templates — you cannot send freeform messages to users who haven’t recently messaged you. A template has a name, language, and variable placeholders:

Template: "Hi {{1}}, your order #{{2}} has been confirmed.
Delivery expected by {{3}}. Track here: {{4}}"

Submit templates to Meta for approval (usually within 24 hours). Once approved, call the API with variable values to send.

Sending a Template Message (Cloud API)

POST https://graph.facebook.com/v18.0/{phone_number_id}/messages
Authorization: Bearer {ACCESS_TOKEN}

{
  "messaging_product": "whatsapp",
  "to": "919620242450",
  "type": "template",
  "template": {
    "name": "order_confirmation",
    "language": { "code": "en_IN" },
    "components": [{
      "type": "body",
      "parameters": [
        {"type":"text","text":"Rahul"},
        {"type":"text","text":"ORD-12345"},
        {"type":"text","text":"25 Jan 2025"},
        {"type":"text","text":"https://track.yoursite.com/12345"}
      ]
    }]
  }
}

Handling Incoming Messages (Webhook)

// Express.js webhook handler
app.post('/webhook/whatsapp', (req, res) => {
  const body = req.body
  if (body.object === 'whatsapp_business_account') {
    body.entry?.forEach(entry => {
      const message = entry.changes?.[0]?.value?.messages?.[0]
      if (message?.type === 'text') {
        console.log('From:', message.from, 'Text:', message.text.body)
        // Handle message — route to support, trigger auto-reply, etc.
      }
    })
    res.status(200).send('OK')
  } else { res.sendStatus(404) }
})

Common Integration Patterns We’ve Built

  • Order notifications (e-commerce): Confirmed → packed → shipped (with tracking link) → delivered. 4 templates, triggered on status change.
  • OTP delivery: Use the authentication template category — higher deliverability than SMS in India, Android auto-fill support.
  • Appointment reminders: 24-hour and 2-hour reminders triggered by a scheduled job. Dramatically reduces no-shows.
  • Customer support routing: Incoming messages routed to CRM/helpdesk, auto-acknowledgement within 30 seconds, assigned to human agent.

Pricing and India Notes

Cloud API: free up to 1,000 business-initiated conversations/month. Beyond that: approximately ₹0.35–₹0.70 per conversation (India rates). User-initiated conversations are cheaper. Phone numbers must be in international format: 91XXXXXXXXXX (no + in API calls). Hindi templates are supported. DLT registration (required for SMS) does NOT apply to WhatsApp.

Need WhatsApp Business API integration? We’ve built WhatsApp automations for e-commerce, events, healthcare, and logistics clients. Discuss your integration →
V
Vedhin Technology

IT services & staff augmentation from Jaipur, India. We build web apps, mobile apps, and cloud solutions from $15/hr.

← Previous Managing a Remote Development Team: 10 Lessons from 3+ years Next → How We Built rochevents.in: A Technical Deep Dive into an Event Management Platform
Keep Reading

Related Articles

Ready to Start?

Let's Build Something Amazing Together

First consultation is always free. We'll assess your requirements and give you an honest timeline and cost estimate — within 24 hours.