Messaging
Send WhatsApp messages to your contacts from your own system, with fixed text, templates or text written by the avatar.
Use these endpoints to start conversations with your contacts from your own system: a payment reminder, an order update, a follow-up after a visit. Each call can reach one contact or a whole list. The avatar takes over the conversation when the contact replies.
Choose a mode
| Mode | What is sent | Use it when |
|---|---|---|
| Fixed | Your text, with the contact's data filled in. | The message is always the same, only names and values change. |
| Template | An approved WhatsApp template, with its variables. | You need to reach contacts who have not written to you in the last 24 hours. |
| AI | A message the avatar writes for each contact, following your instructions. | Each message should sound personal and use the contact's history. |
| AI Template | An approved template whose variables the avatar fills for each contact. | You want personal content and need to reach contacts outside the 24-hour window. |
The 24-hour rule
WhatsApp only accepts free text within 24 hours after the contact's last message. To start a conversation, or to write to a contact after that window, WhatsApp requires a template that Meta has approved.
- Template and AI Template let you choose the template for each send.
- Fixed and AI do not choose a template. On WhatsApp, the text goes through the default template configured for your account's avatar messages. Ask Tolky to check this setting before you rely on these modes for new contacts.
Calls are queued and sent in the background. A successful response means the messages were accepted, not that they were delivered.
Avoid duplicate contacts (Brazilian 9th digit)
Brazilian mobile numbers may be stored with or without the extra 9 after the area code. Before a large send, check your list: the sibling check tells you, for each number, whether a contact with the other form already exists, so you do not create the same person twice.
ReferenceTechnical details
Endpoints
| Mode | Method and path |
|---|---|
| Fixed | POST /api/externalAPIs/public/externalNotificationFixed |
| Template | POST /api/externalAPIs/public/externalNotificationTemplate |
| AI | POST /api/externalAPIs/public/externalNotificationAI |
| AI Template | POST /api/externalAPIs/public/externalNotificationAITemplate |
| Sibling check | POST /api/externalAPIs/public/externalLeadSiblingCheck |
All of them use a host token: Authorization: Bearer $TOLKY_TOKEN. The account is taken from the token.
Common parameters
| Name | Type | Required | Description |
|---|---|---|---|
data | array | Yes | One item per contact. You can also send a single contact as the body itself. |
data[].phone | string | Yes | Number with country code, digits only, for example 5511999999999. |
data[].name | string | No | Contact name. |
data[].id | string | No | Your own ID for the contact, kept with the send. |
externalCampaignId | string | No | Groups sends into one campaign. When omitted, an ID is generated from the mode and the current month. |
dialogueInserts | string | No | Instructions the avatar receives to continue the conversation after this message. |
expireAt | string | No | Campaign expiry date, YYYY-MM-DD. |
Any other field you put in an item travels with the contact: it fills placeholders in Fixed mode and gives context to the avatar in the AI modes.
Mode-specific parameters
| Name | Modes | Type | Required | Description |
|---|---|---|---|---|
fixedMessage | Fixed | string | Yes | Text with placeholders in braces, for example Hi {name}, your bill of {amount} is due {dueDate}. |
template | Template, AI Template | string | Yes | Name of an approved template in your WhatsApp account. |
data[].templateParams | Template | string[] | When the template has variables | Values for the template variables, in order. The count must match the template, otherwise that message fails during sending. |
generalInstructions | AI, AI Template | string | Yes | What the avatar should write, for example the goal and tone of the message. |
pauseConversation | AI, AI Template | boolean | No | When true, the conversation is paused after the send. |
channel | Fixed, AI | string | No | whatsapp (default) or teams. With teams, each item needs an email. |
Examples
Fixed
curl -X POST "https://api.tolky.to/api/externalAPIs/public/externalNotificationFixed" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fixedMessage": "Hi {name}, your bill of {amount} is due on {dueDate}.",
"externalCampaignId": "billing-reminders",
"data": [
{ "phone": "5511999999999", "name": "Maria", "amount": "$150.00", "dueDate": "07/15" }
]
}'Template
curl -X POST "https://api.tolky.to/api/externalAPIs/public/externalNotificationTemplate" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"template": "order_update",
"data": [
{ "phone": "5511999999999", "name": "Maria", "templateParams": ["Maria", "#4821"] }
]
}'AI Template
curl -X POST "https://api.tolky.to/api/externalAPIs/public/externalNotificationAITemplate" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"template": "visit_follow_up",
"generalInstructions": "Thank the customer for the visit and invite them to book a return.",
"data": [
{ "phone": "5511999999999", "name": "Maria", "lastService": "Haircut" }
]
}'Response
{
"code": 200,
"message": "OK",
"data": {
"trackingId": "3f0c2a8e-...",
"timestamp": "2026-07-01T12:00:00.000Z",
"summary": { "totalItems": 1, "validItems": 1, "skippedItems": 0, "queuedItems": 1, "failedItems": 0 },
"processedItems": [
{ "status": "queued", "phone": "5511999999999", "campaignId": "3f0c2a8e-...", "message": "Mensagem enviada para processamento" }
],
"error": null,
"time": 120,
"message": "1 mensagens foram enviadas para processamento em fila. ..."
}
}| Field | Description |
|---|---|
trackingId | ID of the campaign that groups this send. |
summary.totalItems | Items received. |
summary.validItems | Items with content, after empty ones were removed. |
summary.skippedItems | Empty items that were ignored. |
summary.queuedItems | Messages queued for sending. |
summary.failedItems | Items rejected before queuing, for example a Teams item without e-mail. |
processedItems[].status | queued or failed. When failed, message says why. |
time | Processing time in milliseconds. |
The message texts are in Portuguese.
Errors
| Code | When |
|---|---|
400 | Missing required field, template not found, pix sent to a template without the PIX button, or channel: "teams" with a template mode. |
401 | The token does not resolve to an account. |
500 | Unexpected error. |
Error bodies follow { "code", "message", "data": { "error": { "name", "message", "code" } } }.
PIX payments in templates
When the template has the PIX copy-code button, Template and AI Template modes require PIX data for each contact. Send it in data[].pix. Fields you repeat for every contact can go in a top-level pix object, used as the default.
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | PIX copy-and-paste code. |
amount | string | Yes | Amount in reais, for example "149,90". |
merchantName | string | Yes, here or in the top-level pix | Receiver name. |
key | string | Yes, here or in the top-level pix | Receiver PIX key. |
keyType | string | Yes, here or in the top-level pix | CPF, CNPJ, EMAIL, PHONE or EVP. |
referenceId | string | No | 1 to 35 characters: letters, numbers, _, . and -. |
description | string | No | Up to 60 characters. |
An item with invalid PIX data is not queued: it comes back with status: "failed" and the reason. In AI Template mode the avatar does not see the pix object. If the amount must appear in the text, also send it as a normal field.
Sibling check
POST /api/externalAPIs/public/externalLeadSiblingCheck only reads. It does not create or change contacts.
| Name | Type | Required | Description |
|---|---|---|---|
phones | string[] | Yes, or data | Numbers to check. |
data | array | Yes, or phones | Same shape as a send: [{ "phone": "..." }]. |
defaultCountry | string | No | Country used to read numbers without country code. Default BR. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/externalLeadSiblingCheck" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "phones": ["5511999999999", "551199999999"] }'{
"code": 200,
"message": "OK",
"data": {
"summary": { "total": 2, "withAlerts": 0, "withoutAlerts": 2, "autoResolvable": 1, "skipped": 0 },
"results": [
{
"phone": "551199999999",
"hasAlert": false,
"autoResolvable": true,
"matchType": "sibling9",
"recommendation": "use_existing",
"recommendedPhone": "5511999999999",
"candidates": [{ "phone": "5511999999999", "name": "Maria", "isExact": false, "validated": true }],
"description": "..."
}
],
"skipped": []
}
}| Field | Description |
|---|---|
results[].hasAlert | true when a person should review this number before the send. |
results[].autoResolvable | true when the send will reuse the existing validated contact on its own. No action needed. |
results[].matchType | exact, sibling9, both_exact_validated, both_sibling_validated, both_none_validated, both_validated, cross_number (one form is a landline, the other a mobile) or none. |
results[].recommendation | use_existing, review_manual or null. |
results[].recommendedPhone | The form to use when the recommendation is use_existing. |
results[].candidates | Contacts found with either form. validated means WhatsApp confirmed the number. |
results[].description | Explanation in Portuguese. |
skipped | Numbers that are invalid or not Brazilian. The 9th digit check does not apply to them. |