Skip to content

Send a WhatsApp Message

POST /v1/whatsapp/send

Dispatches a WhatsApp message to a user. You can send free-form text messages (if within the 24-hour customer service window) or pre-approved Template Messages to initiate a conversation.

Authentication

All requests to this endpoint must include your API key in the Authorization header as a Bearer token.

HeaderTypeRequiredDescription
AuthorizationstringYesBearer sk_live_YOUR_API_KEY
Idempotency-KeystringNoA unique UUIDv4 to prevent duplicate deliveries on network retries.

Request Body

Send an application/json payload with the following parameters:

ParameterTypeRequiredDescription
tostringYesThe destination WhatsApp number in E.164 format (e.g., +14155552671).
typestringYesThe type of message to send. Enum: text, template, image, document, interactive.
textobjectNo*Required if type is text. Contains the body string of the message.
templateobjectNo*Required if type is template. Contains the name, language, and components arrays.

*Note: Payload structure changes depending on the type parameter.

Example: Send a Text Message

If a user has messaged your business within the last 24 hours, you can reply with a standard free-form text message.

bash
curl -X POST https://api.sendapi.co/v1/whatsapp/send \
  -H "Authorization: Bearer sk_live_123456789" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+447700900000",
    "type": "text",
    "text": {
        "body": "Hello! How can our support team assist you today?"
    }
  }'
javascript
import { SendAPI } from '@sendapi/node';

const client = new SendAPI('sk_live_123456789');

const response = await client.whatsapp.send({
  to: '+447700900000',
  type: 'text',
  text: {
    body: 'Hello! How can our support team assist you today?'
  }
});

Example: Send a Template Message

To initiate a conversation with a user outside the 24-hour window, you must use a pre-approved Meta template.

bash
curl -X POST https://api.sendapi.co/v1/whatsapp/send \
  -H "Authorization: Bearer sk_live_123456789" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+447700900000",
    "type": "template",
    "template": {
        "name": "shipping_update",
        "language": { "code": "en_US" },
        "components": [
            {
                "type": "body",
                "parameters": [
                    { "type": "text", "text": "Alice" },
                    { "type": "text", "text": "Order #12345" }
                ]
            }
        ]
    }
  }'

Response

Returns a Message object indicating that the payload has been accepted by Meta's graph API.

json
{
  "id": "wa_01H8BKF...Z2T",
  "object": "whatsapp.message",
  "status": "accepted",
  "to": "+447700900000",
  "created_at": "2026-03-09T14:30:00Z"
}

Webhooks

WhatsApp messaging heavily relies on asynchronous webhooks. When Meta successfully delivers the message to the user's phone, and when the user reads the message, SendAPI will HTTP POST a message.delivered and message.read event to your configured Webhook URL.

Released under the MIT License.