← Back to Blog
    WhatsApp Marketing12 min read

    How to Send a WhatsApp Message via API: A Complete Developer and No-Code Guide

    Learn how to send WhatsApp messages via the API β€” from template messages and session replies to bulk broadcasts. Covers direct API calls, code examples, and no-code alternatives through an official BSP.

    BP

    Biswajit Pradhan

    May 1, 2026

    Sending a WhatsApp message via the API sounds like a developer task. And it can be β€” if you want to call the endpoint directly. But for most businesses, the goal is simpler: get messages out to customers reliably, at scale, without building and maintaining custom infrastructure. Understanding how the API works gives you the vocabulary to choose the right approach and avoid the mistakes that trip up most first-time implementations.

    This guide covers everything involved in sending WhatsApp messages via the API: the two message types, the two access methods, a walkthrough of the actual API call, and how to achieve the same outcomes without touching a line of code.

    What "Sending via API" Actually Means

    The WhatsApp Business API (formally the WhatsApp Business Platform) is Meta's programmatic interface for business messaging. Instead of typing messages into an app, you or your software sends an HTTP request to Meta's Cloud API endpoints. Meta delivers the message to the recipient's WhatsApp app. The recipient's reply comes back to you via a webhook.

    This model enables things the WhatsApp Business App cannot:

    • Sending messages triggered by events in your own systems (orders placed, payments received, appointments booked)
    • Sending to thousands of contacts simultaneously through bulk broadcast
    • Running automated chatbot flows that respond to incoming messages without a human
    • Routing conversations to the right agent in a shared team inbox
    • Pulling delivery and read data back into your CRM or analytics stack

    The API is not a separate product you download. It is an interface layer you access either directly (by making HTTP calls from your own code) or indirectly through a Business Solution Provider (BSP) that has already built a platform on top of it.

    The Two Types of Messages You Can Send

    Before looking at implementation, it is important to understand that the API distinguishes between two fundamentally different message types, each with different rules.

    Template Messages (Business-Initiated)

    Template messages are pre-approved message formats submitted to Meta and reviewed before use. They are the only type of message you can send to a customer outside of an active 24-hour conversation window β€” meaning you can use them to reach out first, or to re-engage a contact who has not messaged you recently.

    Templates support:

    • Text with variables: personalise with the recipient's name, order number, or any dynamic value
    • Header media: attach an image, video, or document above the message body
    • Footer text: a short line beneath the body
    • Buttons: up to 3 quick-reply buttons or a call-to-action button (URL or phone number)

    Template messages fall into three business-initiated categories:

    • Utility: transactional messages tied to an agreed interaction β€” order confirmations, shipping updates, payment receipts
    • Authentication: one-time passwords and verification codes
    • Marketing: promotions, offers, newsletters, and any other proactive outreach

    Every template must pass Meta's approval process (typically 24–48 hours) before it can be sent. Meta enforces its content policy at approval time, so templates that are overly promotional, misleading, or violate usage policies will be rejected.

    Session Messages (User-Initiated)

    When a customer sends your WhatsApp number a message, a 24-hour service window opens. Within that window, you can send any type of reply β€” free-form text, images, documents, interactive lists, product cards, or location data β€” without needing a pre-approved template.

    Session messages are what power real-time support conversations, chatbot response flows, and any interactive dialogue that unfolds after a customer reaches out. Once the 24-hour window closes, you are back to requiring a template to re-open the conversation.

    Most production WhatsApp setups use both types: templates for proactive outreach and automated notifications, session messages for the responsive, conversational layer.

    Method 1: Calling the API Directly

    For developers who want full control, the WhatsApp Cloud API is a standard REST API that accepts JSON payloads over HTTPS. Here is what a basic API call looks like.

    Prerequisites

    Before making your first API call you need:

    1. A Meta developer account and a Meta app configured for WhatsApp
    2. A WhatsApp Business Account (WABA) linked to your Meta app
    3. A phone number registered and verified on the API
    4. A System User access token with the whatsapp_business_messaging permission

    Sending a Template Message

    The endpoint for sending messages is:

    POST https://graph.facebook.com/v19.0/{phone-number-id}/messages

    A minimal request to send a template message looks like this:

    json
    {
    

    "messaging_product": "whatsapp",

    "to": "919876543210",

    "type": "template",

    "template": {

    "name": "order_confirmation",

    "language": {

    "code": "en"

    },

    "components": [

    {

    "type": "body",

    "parameters": [

    { "type": "text", "text": "Priya" },

    { "type": "text", "text": "ORD-10293" }

    ]

    }

    ]

    }

    }

    The to field takes the recipient's full phone number in international format without the + prefix. The template.name must match the exact name of an approved template in your WABA. The components array maps your dynamic variables to the placeholder positions in the template body.

    A successful response returns a messages object containing the id of the message and its initial status (accepted).

    Sending a Session Message

    Within an active 24-hour window, sending a free-text reply is even simpler:

    json
    {
    

    "messaging_product": "whatsapp",

    "to": "919876543210",

    "type": "text",

    "text": {

    "body": "Thanks for reaching out! Your order ORD-10293 has shipped and will arrive by Friday. Let us know if you have any questions."

    }

    }

    Sending a Message with Buttons

    Interactive messages significantly improve engagement compared to plain text. Here is a reply-button message:

    json
    {
    

    "messaging_product": "whatsapp",

    "to": "919876543210",

    "type": "interactive",

    "interactive": {

    "type": "button",

    "body": {

    "text": "Your order is out for delivery. Would you like to track it?"

    },

    "action": {

    "buttons": [

    { "type": "reply", "reply": { "id": "track_order", "title": "Track Order" } },

    { "type": "reply", "reply": { "id": "contact_support", "title": "Contact Support" } }

    ]

    }

    }

    }

    When the recipient taps a button, the API fires a webhook event to your server containing the button's id value, which your code uses to determine the next step.

    Authentication

    All API calls require a Bearer token in the Authorization header:

    Authorization: Bearer {system-user-access-token}

    Tokens are generated through Meta Business Manager under System Users. Use a System User token rather than a User token for production environments β€” System User tokens do not expire and are not tied to an individual's personal account.

    Receiving Messages and Status Updates via Webhooks

    Sending messages is half the picture. To receive incoming messages and delivery status updates, you must configure a webhook endpoint. When a customer replies, Meta sends a POST request to your webhook URL containing the message content, sender details, and a timestamp. Your server must:

    1. Validate the request using the X-Hub-Signature-256 header (HMAC-SHA256 verification with your app secret)
    2. Respond with HTTP 200 within 5 seconds
    3. Process the event asynchronously if handling takes longer

    Status update events (sent, delivered, read, failed) arrive on the same webhook and let you track message delivery without polling.

    Rate Limits and Error Handling

    The Cloud API enforces per-second rate limits that scale with your messaging tier. Exceeding the limit returns a 429 response. Build exponential backoff retry logic into your send function, and use a message queue for high-volume sending rather than firing requests synchronously.

    Common error codes to handle:

    Error CodeMeaningAction
    130429Rate limit hitBack off and retry
    131047Message outside 24h windowUse a template message instead
    131030Template not found or not approvedVerify template name and status
    132001Template body variables mismatchCheck component parameter count
    131026Recipient not on WhatsAppSkip or mark as undeliverable

    Method 2: Sending via a BSP Platform (No-Code)

    Direct API integration gives maximum flexibility, but it comes with significant engineering overhead: webhook infrastructure, retry logic, error handling, template management, contact storage, and ongoing maintenance as Meta updates its API version. For many businesses, the better path is using a WhatsApp Business Solution Provider.

    A BSP is a Meta-authorised company that has built a platform on top of the WhatsApp API, handling all the infrastructure complexity and exposing the API's capabilities through a no-code interface.

    What You Can Do Without Writing Code

    Through a BSP platform like Greenbubble, you can:

    Send template messages to a list β€” upload your opted-in contact list, select a pre-approved template, personalise it with variables from your contact data, and schedule or immediately send to the entire list. This is the no-code equivalent of a bulk broadcast loop that would take hundreds of lines of code to build from scratch.

    Trigger automated messages from events β€” configure automation rules that fire a template message when a specific event occurs (a new form submission, a tag added to a contact, a webhook received from your CRM). No custom code; just configure the trigger and the template.

    Build chatbot flows that send session messages β€” the no-code chatbot builder lets you design conversation flows visually. When a message matches a trigger condition, the bot sends the configured response β€” text, image, buttons, or list β€” without any manual sending.

    Reply from a shared inbox β€” agents send session messages manually through a shared inbox interface, with full conversation history and contact context visible. Every reply goes out through the API automatically, without agents needing API credentials or developer knowledge.

    Personalise at scale β€” BSP platforms map contact attributes (name, city, order ID, etc.) to template variables automatically, so every message feels individual even when sending to tens of thousands of contacts.

    Which Approach Is Right for You?

    RequirementDirect APIBSP Platform
    Custom integration into existing systemsBest fitPossible via BSP webhooks/integrations
    No coding resources availableNot suitableBest fit
    Real-time event-triggered sends from custom logicBest fitSuitable for common use cases
    Team inbox for agentsRequires buildingBuilt-in
    Visual chatbot flow builderRequires buildingBuilt-in
    Template management UIRequires buildingBuilt-in
    Fast time-to-launchSlowFast (hours, not weeks)

    If your primary need is marketing campaigns, support automation, and team messaging, a BSP is almost always the right call. If you are building a deeply integrated product β€” for example, embedding WhatsApp messaging directly into your own SaaS platform β€” direct API access makes more sense.

    Practical Use Cases for Sending WhatsApp Messages via API

    Order and shipment notifications β€” trigger utility template messages automatically when an order is confirmed, dispatched, or delivered. Each message is personalised with the customer's name, order number, and tracking link. No human touch required; the integration fires the message the moment the status changes in your order management system.

    Abandoned cart recovery β€” send a template message to customers who added items to their cart but did not complete checkout. WhatsApp abandoned cart recovery typically outperforms email for this use case, with open rates significantly higher and response times much shorter.

    Appointment reminders β€” trigger a template message 24 hours and 1 hour before a scheduled appointment. Include a quick-reply button to confirm or cancel, reducing no-shows without requiring any manual follow-up.

    Lead qualification chatbots β€” when a lead comes in from a WhatsApp click-to-chat ad or a website form with a WhatsApp CTA, send an automated welcome template, then use the session window to run a qualification flow via interactive messages.

    Bulk promotional broadcasts β€” send marketing templates to your opted-in subscriber list for product launches, flash sales, and seasonal campaigns. The bulk broadcast feature handles the sending infrastructure; you focus on the message content and targeting.

    Customer support automation β€” a WhatsApp chatbot handles tier-1 support queries automatically using session messages, escalating to a human agent when needed via the shared inbox.

    Template Approval Best Practices

    Getting templates approved quickly β€” and keeping them live β€” requires attention to how you write them.

    Be specific, not vague. Meta is more likely to approve a template with a clear purpose. "Hi {{1}}, your order {{2}} has been shipped and will arrive by {{3}}. Track here: {{4}}" will clear faster than a generic "Hi {{1}}, check out our latest update."

    Match the category accurately. Submitting a promotional message as a utility template is a common rejection trigger. If the message is marketing, declare it marketing.

    Avoid absolute claims and excessive punctuation. Multiple exclamation marks, ALL CAPS sections, and phrases like "GUARANTEED" or "100% FREE" are content policy red flags.

    Test variables carefully. Mismatched variable counts between what you declare and what you send at runtime cause 132001 errors. Map every {{n}} placeholder to a parameter in your components array before production sends.

    Compliance: Opt-In Is Non-Negotiable

    The WhatsApp API explicitly requires that all recipients of business-initiated messages have opted in to receive WhatsApp messages from your business. Opt-in must be obtained outside of WhatsApp β€” through a website form, at checkout, via SMS confirmation, or through a physical sign-up process.

    Sending template messages to contacts who have not opted in will generate high block rates. High block rates damage your quality rating, which can trigger messaging limit reductions or, in severe cases, account suspension.

    Before any send, verify that every contact in your list has a recorded opt-in. Most BSP platforms include opt-in management tools that track consent status per contact.

    Frequently Asked Questions

    Do I need a verified Meta Business account to send messages via the API?

    You need a Meta Business Account, but full verification (the blue checkmark process) is not required to get started. Unverified accounts can still send messages but have lower messaging tier limits and cannot use certain template categories. Verification expands your capabilities and is worth completing once you are ready to scale.

    Can I send WhatsApp messages via API for free?

    The WhatsApp Business API itself charges per conversation (a 24-hour window), not per message. Meta provides 1,000 free user-initiated (service) conversations per month. Business-initiated conversations β€” including marketing and utility templates β€” are charged at rates that vary by country. There is no free tier for marketing templates beyond the included service conversations.

    What is the character limit for WhatsApp messages sent via API?

    The body of a WhatsApp text or template message can be up to 1,024 characters. Template headers are limited to 60 characters for text headers. For most business messages, these limits are more than sufficient.

    Can I send WhatsApp messages via API to someone who does not have me saved as a contact?

    Yes. Recipients do not need to have saved your number to receive WhatsApp messages from a business account. They will see your business name and logo (once your WhatsApp Business Profile is configured) regardless of whether they have your number saved.

    How do I know if a message was delivered and read?

    Delivery and read receipts arrive as webhook events. The status field cycles through sent β†’ delivered β†’ read as the message moves through the delivery chain. If a send fails, you receive a failed status event with an error code. BSP platforms surface these statuses in their analytics dashboards automatically, so you do not have to build status tracking yourself.

    Is there a limit to how many messages I can send per day?

    New API accounts start at Tier 1 (1,000 unique contacts per day). Meta automatically upgrades your tier as your account demonstrates consistent, high-quality sending. Tiers scale to 10,000, 100,000, and eventually unlimited daily contacts. Quality rating β€” influenced by block rates and engagement β€” is the key factor in tier progression.

    Send WhatsApp Messages via API with Greenbubble

    Whether you are building a direct integration or looking for a faster path to production, Greenbubble covers both use cases. As an official WhatsApp Business Solution Provider, Greenbubble gives you full access to the WhatsApp Business API through a platform that handles all the infrastructure complexity β€” so you can send template messages, run automated chatbot flows, manage a shared team inbox, and run bulk broadcast campaigns without maintaining your own API integration.

    For teams that do need custom integrations, Greenbubble's webhook and API tools connect to your existing systems, letting you trigger WhatsApp sends from events in your CRM, e-commerce platform, or internal tooling.

    View Greenbubble's pricing plans and start sending WhatsApp messages via the API today β€” setup takes under an hour.

    Ready to Automate Your WhatsApp?

    Start your free 14-day trial with Greenbubble.io. No credit card required.

    Start Free Trial β†’