Skip to main content
POST
Send a WhatsApp template

Authorizations

Authorization
string
header
required

A project API key, created in the dashboard.

Headers

Idempotency-Key
string

A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.

Required string length: 1 - 255

Body

application/json

Pass exactly one of to and conversation_id. Unknown parameters return 422.

agent_id
string
required
Maximum string length: 64
template_id
string
required

ID of an approved template, from List WhatsApp templates.

Maximum string length: 64
to
string
required

A phone number in E.164 international format.

Pattern: ^\+[1-9][0-9]{6,14}$
Example:

"+14155550123"

conversation_id
string

ID of a WhatsApp conversation of the AI agent that hasn't ended.

Maximum string length: 64
variables
object

A value for each of the template's variables, keyed by its key.

Example:
author_id
string | null

The account_id of the team member to send the template as, from List members. They must be able to reply in the AI agent's conversations. Defaults to the API key's creator.

Maximum string length: 64
mode
enum<string>
default:ai

ai keeps the conversation's mode, and live takes it over for the author.

Available options:
ai,
live

Response

The template was sent and saved. conversation_id is the conversation it was saved in.

object
any
required
id
string
required
conversation_id
string
required
author
object
required

Who sent the message.

type
enum<string>
required

buttons, carousel, form, booking, csat_survey, end_chat, email_prompt, contact_card, and action messages have details in data. action messages record what an AI agent's actions did, such as HTTP requests and integrations, and a chatbot's handoffs to the team. Only the team sees them. carousel and contact_card messages come from chatbots. A chatbot's image, video, audio, and document messages include the file's url in data. Other types come from other channels and only have text. Files of any type are in attachments.

Available options:
text,
buttons,
carousel,
form,
booking,
csat_survey,
end_chat,
email_prompt,
action,
contact_card,
attachment,
image,
video,
audio,
document,
sticker,
other
text
string | null
required

The message text, in Markdown. AI replies don't include inline citation markers; their sources are in data. null for messages with only data.

data
object
required

Details of the message, depending on its type. text messages from the agent include their sources. null for other text messages and for an AI agent's media messages.

attachments
object[]
required

Files sent with the message, in order. A caption is the message's text.

is_note
boolean
required

Whether the message is an internal note, which the user never sees.

sent_by_website
boolean
required

Whether the website sent this user message with window.Chatling.sendMessage(), rather than the user typing it.

is_hidden
boolean
required

Whether the website sent this message with hidden: true. The AI agent receives hidden messages, but the user never sees them.

rating
enum<string> | null
required

The rating of an AI-written answer, given by the user in the widget or set with Update a message. Always null for other messages.

Available options:
positive,
negative,
null
created_at
string<date-time> | null
required