Skip to content
WhatSync/DocsAPI v1

Send one WhatsApp message now

SENDS a real WhatsApp message to exactly one recipient from the agent.

POST/api/v1/tools/send_messageWrite
Key permissions
Read chats and messages + Send messages
Authentication
Authorization: Bearer $WHATSYNC_API_KEY
How keys work

How it works

  • Use only after the user explicitly asks to send to this recipient.
  • For a new official Business conversation, use an approved template and confirm recipient opt-in.
  • Templates with media headers or buttons that need a value are not supported; fixed buttons are.
  • The recipient cannot be the connected Business number itself.
  • For a free-form Business reply, the recipient must have messaged within 24 hours.
  • QR sends go from the linked number.
  • With several numbers: from the number given as fromNumber, otherwise the one number the chat is on; when that is not clear (nobody chatted with this person yet, or the chat is on several numbers) a text is not sent and the result has draft_link, so ask the user which number and send again with fromNumber.
  • Never use this tool for bulk sends, guesses, or automatic retries; provider acceptance is not delivery.
  • The same text to the same person within an hour is refused.
  • If a QR text will not be sent (sending turned off for the number, its daily send limit used, or the daily limit for people this number never chatted with), nothing is sent and the result has draft_link: a WhatsApp link the user opens to send it themselves.

Body parameters

idempotencyKeystringbody or header

A fresh random UUID for each new action; never build it from dates, names, counters or step numbers, which repeat across runs. Reuse it exactly only to retry the same action.

channelqr | businessoptional

Required when both accounts are connected; templates always use Business

fromNumberstringoptional

Which of the account's WhatsApp numbers sends, with country code, as listed in whatsapp_numbers from get_account_context. Only matters when the account has several numbers; omit it to use the number the chat is on

conversationIdstringoptional

The exact conversation_id value from another WhatSync tool, if sending into an existing chat

phoneNumberstringoptional

One recipient's phone number with country code

textstringoptional

Exact free-form message to send; omit for a template

templateNamestringoptional

Approved Business template name; omit for free-form text

templateLanguagestringoptional

Language of the approved template, such as en_US. Defaults to en_US for send_message.

templateParametersstring[]optional

Values for the approved template body variables, in numbered order.

expectedPreviewstringoptional

Optional exact rendered template text to verify against Meta's current template: header, filled-in body, footer and 'Button: ...' lines, separated by blank lines. Omit it unless you copied it from a previous WhatSync result

recipientOptInConfirmedbooleanoptional

Required true for Business templates only when the recipient agreed to receive messages

Conditions and pagination

  • Choose channel explicitly when both QR and Business are connected. Never switch channels automatically after an error.
  • Provide phoneNumber or an exact conversationId from a previous result. If you supply both, they must identify the same person. send_message with a group's conversationId sends text as send_group_message does; the other two tools do not take groups.
  • For text, supply text and omit templateName. For a Business template, supply templateName, channel=business and recipientOptInConfirmed=true; use its approved language and parameters. Do not supply text and templateName together. Business text replies require an incoming customer message within 24 hours. Template language defaults to en_US.
  • Use a unique idempotency key for each intended action. Reuse the same key and exactly the same input on a retry. The body key takes precedence over Idempotency-Key.

Response

intent_id identifies the durable send. accepted means the provider accepted it, not confirmed delivery. Inspect get_send_status using intentId; delivery_status may remain null. An uncertain send returns HTTP 409 with error.intent_id. When it will not go out it returns an error, never a 200: new_people_limit (429, the limit on people the number never chatted with, with Retry-After), daily_limit_reached (429, until 00:00 UTC), sending_off (409, the owner turned sending off) or from_number_required (422, several numbers and no fromNumber). error.sent is false; error.draft_link opens WhatsApp with the message filled in, for a person to send by hand.

Every response includes X-Request-Id. Errors use the shared error format and retry rules.

Schemas

Input JSON Schema
Input JSON Schema
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:-]{8,128}$",
      "description": "A fresh random UUID for each new action; never build it from dates, names, counters or step numbers, which repeat across runs. Reuse it exactly only to retry the same action."
    },
    "channel": {
      "type": "string",
      "enum": [
        "qr",
        "business"
      ],
      "description": "Required when both accounts are connected; templates always use Business"
    },
    "fromNumber": {
      "type": "string",
      "minLength": 7,
      "maxLength": 30,
      "description": "Which of the account's WhatsApp numbers sends, with country code, as listed in whatsapp_numbers from get_account_context. Only matters when the account has several numbers; omit it to use the number the chat is on"
    },
    "conversationId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 250,
      "description": "The exact conversation_id value from another WhatSync tool, if sending into an existing chat"
    },
    "phoneNumber": {
      "type": "string",
      "minLength": 7,
      "maxLength": 30,
      "description": "One recipient's phone number with country code"
    },
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096,
      "description": "Exact free-form message to send; omit for a template"
    },
    "templateName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "Approved Business template name; omit for free-form text"
    },
    "templateLanguage": {
      "type": "string",
      "maxLength": 12
    },
    "templateParameters": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 1024
      },
      "maxItems": 20
    },
    "expectedPreview": {
      "type": "string",
      "maxLength": 4096,
      "description": "Optional exact rendered template text to verify against Meta's current template: header, filled-in body, footer and 'Button: ...' lines, separated by blank lines. Omit it unless you copied it from a previous WhatSync result"
    },
    "recipientOptInConfirmed": {
      "type": "boolean",
      "description": "Required true for Business templates only when the recipient agreed to receive messages"
    }
  },
  "required": [
    "idempotencyKey"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#",
  "anyOf": [
    {
      "required": [
        "phoneNumber"
      ]
    },
    {
      "required": [
        "conversationId"
      ]
    }
  ],
  "allOf": [
    {
      "oneOf": [
        {
          "required": [
            "text"
          ],
          "not": {
            "required": [
              "templateName"
            ]
          }
        },
        {
          "required": [
            "templateName",
            "recipientOptInConfirmed"
          ],
          "not": {
            "required": [
              "text"
            ]
          },
          "properties": {
            "channel": {
              "const": "business"
            },
            "recipientOptInConfirmed": {
              "const": true
            }
          }
        }
      ]
    }
  ]
}
Response JSON Schema
Response JSON Schema
{
  "type": "object",
  "properties": {
    "intent_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string"
    },
    "recipient_phone": {
      "type": "string"
    },
    "channel": {
      "type": "string"
    },
    "provider_message_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "delivery_status": {
      "type": [
        "string",
        "null"
      ]
    },
    "delivery_status_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "delivery_errors": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "description": "Provider or tool-specific fields; preserve unknown fields."
      }
    },
    "next_action": {
      "type": [
        "string",
        "null"
      ]
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "intent_id",
    "status",
    "recipient_phone",
    "channel",
    "provider_message_id",
    "delivery_status"
  ],
  "additionalProperties": true
}