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": "template",
  "content": {
    "template_name": "welcome_template",
    "template_language": "en"
  },
  "recipient": [
    {
      "whatsapp_number": "+910000000000",
      "first_name": "John",
      "email": "john@example.com"
    }
  ],
  "add_recipient_to_contacts": false,
  "parameterized_variables": {
    "organization.company_name": "John Doe"
  },
  "event": {
    "code": "START",
    "name": "start",
    "data": {
      "date_time": "2026-01-27T01:30:21Z"
    }
  },
  "tags": [
    "tag1"
  ]
}
'
{
    "success": true,
    "failed_recipients": [],
    "report": [
        {
            "to": "whatsapp_number",
            "message_id": "message_id"
        }
    ],
    "quotas": {
        "MAX_WHATSAPP_SEND_PER_MONTH": {
            "limit": "usage",
            "usage": "usage"
        }
    },
    "message": "Transactional WhatsApp messages sent successfully."
}
Send WhatsApp messages to one or more recipients using pre-approved templates. This endpoint supports personalization through parameterized_variables and event data.

Request Body

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

Example Payloads

Send a message using a pre-approved WhatsApp template with custom parameters and event data.
{
    "from_number": "<string>",
    "type": "template",
    "content": {
        "template_name": "<string>",
        "template_language": "<string>"
    },
    "recipient": [
        {
            "whatsapp_number": "<string>",
            "first_name": "<string>",
            "email": "<string>"
        },
        {
            "whatsapp_number": "<string>",
            "name": "<string>",
            "email": "<string>"
        }
    ],
    "parameterized_variables": {
        "organization.company_name": "<string>",
        "organization.business_type": "<string>",
        "organization_address.street": "<string>",
        "organization_social.instagram": "<string>"
    },
    "event": {
        "code": "START",
        "name": "start",
        "data": {
            "date_time": "2026-01-27T01:30:21.311Z",
            "event_name": "24hr marathon run",
            "bib_number": "101",
            "start_time": "2026-01-15T01:30:03.588Z"
        }
    },
    "tags": ["tag1"]
}
{
    "success": true,
    "failed_recipients": [],
    "report": [
        {
            "to": "whatsapp_number",
            "message_id": "message_id"
        }
    ],
    "quotas": {
        "MAX_WHATSAPP_SEND_PER_MONTH": {
            "limit": "usage",
            "usage": "usage"
        }
    },
    "message": "Transactional WhatsApp messages sent successfully."
}

Authorizations

Authorization
string
header
required

Use your API key with the 'Bearer ' prefix

Body

application/json

Send a message using a pre-approved WhatsApp template

from_number
string
required
type
enum<string>
default:template
required
Available options:
template
content
object
required
recipient
object[]
required
add_recipient_to_contacts
boolean
default:false

Add recipient to contacts

parameterized_variables
object
event
object
tags
string[]

Array of strings to tag the message with.

Example:
["tag1", "tag2"]

Response

WhatsApp message(s) sent successfully.