POST
/
webhook
/
whatsapp_message
/
send
Transactional WhatsApp
curl --request POST \
  --url https://webhook.cocoonmail.com/webhook/whatsapp_message/send \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from_number": "+910000000000",
  "type": "text",
  "content": {
    "body": "Hello"
  },
  "recipient": [
    {
      "whatsapp_number": "<string>",
      "first_name": "<string>",
      "email": "<string>",
      "attributes": {}
    }
  ]
}
'
{
    "success": true,
    "message": "WhatsApp message(s) sent successfully."
}
Send WhatsApp messages to one or more recipients using pre-approved templates. This endpoint supports personalization through overwrite_variables and event data.

Request Body

The request body must include the sender’s phone number, template details, and recipient information.
  • overwrite_variables: An object containing key-value pairs used to replace dynamic variables or merge tags within the chosen WhatsApp template.
  • event: (Optional) Event-related data for tracking or triggering specific workflows.

Example Payloads

Send a simple text message to recipients.
{
    "from_number": "<string>",
    "type": "text",
    "content": {
        "body": "<string>"
    },
    "recipient": [
        {
            "whatsapp_number": "<string>",
            "first_name": "<string>",
            "email": "<string>",
            "attributes": {
                "city": "<string>",
                "plan": "<string>"
            }
        },
        {
            "whatsapp_number": "<string>",
            "name": "<string>",
            "email": "<string>",
            "attributes": {
                "city": "<string>",
                "area": "<string>"
            }
        }
    ]
}
{
    "success": true,
    "message": "WhatsApp message(s) sent successfully."
}

Authorizations

Authorization
string
header
required

Use your API key with the 'Bearer ' prefix

Body

application/json

Send a simple text message

from_number
string
required
Example:

"+910000000000"

type
enum<string>
default:text
required
Available options:
text
Example:

"text"

content
object
required
recipient
object[]
required

Response

WhatsApp message(s) sent successfully.