Send And Receive Messages

This page describes how to quickly send and receive WhatsApp messages using the 360dialog Messaging API.

Prerequisites

Ensure the following are available:

  • An approved WhatsApp Business Account (WABA)

  • A registered phone number

  • An API Key

  • A HTTPS webhook endpoint

Basic knowledge of REST APIs and webhooks is recommended.

1

Understand Customer Service Windows

WhatsApp messaging follows a conversation-based model using customer service windows.

Free-form messages can only be sent when a customer service window is open.

A customer service window opens when:

  • A WhatsApp user sends a message to the business phone number, or

  • A template message is sent and delivered to the user

If no customer service window exists, text messages sent using the API will not be delivered.

To start messaging for the first time, one of the following must occur:

  • The user messages the business number first, or

  • A template message is sent to initiate the conversation

2

Prepare The API Request

All Messaging API requests use the base URL:

https://waba-v2.360dialog.io

Messages are sent using the endpoint:

POST /messages

Full request URL:

POST https://waba-v2.360dialog.io/messages

3

Authorise The Request

Add the API Key header to every request:

D360-API-KEY: {{api-key}}

Requests sent without an API key will be rejected.

4

Send a message

Option A: Send A Text Message (Customer Service Window Open)

When a customer service window is open, send a free-form text message using the API.

curl \
  -X POST https://waba-v2.360dialog.io/messages \
  -H "D360-API-KEY: {{api-key}}" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "PHONE_NUMBER",
    "type": "text",
    "text": {
      "body": "Hello from WhatsApp API"
    }
  }'

A successful response returns a message ID confirming the request was accepted.

Option B: Send A Template Message (No Customer Service Window Open)

If no customer service window is open, a template message must be sent to initiate the conversation.

Template messages must be approved before use.

Example template message request:

curl \
  -X POST https://waba-v2.360dialog.io/messages \
  -H "D360-API-KEY: {{api-key}}" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "PHONE_NUMBER",
    "type": "template",
    "template": {
      "name": "hello_world",
      "language": {
        "code": "en_US"
      }
    }
  }'
5

Configure A Webhook

Webhooks deliver real-time events when messages are sent or received.

Configure a callback URL that:

  • Uses HTTPS

  • Has a valid SSL certificate

  • Returns HTTP status 200 OK for all incoming requests

  • Responds quickly (max latency 80ms)

Webhook events include:

  • Incoming user messages

  • Message status updates (sent, delivered, read)

If a webhook delivery fails or a non-200 status code is returned, the WhatsApp Business Platform retries delivery using exponential backoff for several days (up to 7 days) or until delivery succeeds.

There are several options to set the webhook URL using our API.

6

Test Incoming Messages

  1. Send a WhatsApp message from a mobile device to the business number.

  2. Observe the webhook endpoint.

  3. Confirm an incoming message payload is received.

Receiving webhook events confirms messaging is fully operational.

Last updated

Was this helpful?