Developers
ENPT

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

ModeWhat is sentUse it when
FixedYour text, with the contact's data filled in.The message is always the same, only names and values change.
TemplateAn approved WhatsApp template, with its variables.You need to reach contacts who have not written to you in the last 24 hours.
AIA message the avatar writes for each contact, following your instructions.Each message should sound personal and use the contact's history.
AI TemplateAn 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

ModeMethod and path
FixedPOST /api/externalAPIs/public/externalNotificationFixed
TemplatePOST /api/externalAPIs/public/externalNotificationTemplate
AIPOST /api/externalAPIs/public/externalNotificationAI
AI TemplatePOST /api/externalAPIs/public/externalNotificationAITemplate
Sibling checkPOST /api/externalAPIs/public/externalLeadSiblingCheck

All of them use a host token: Authorization: Bearer $TOLKY_TOKEN. The account is taken from the token.

Common parameters

NameTypeRequiredDescription
dataarrayYesOne item per contact. You can also send a single contact as the body itself.
data[].phonestringYesNumber with country code, digits only, for example 5511999999999.
data[].namestringNoContact name.
data[].idstringNoYour own ID for the contact, kept with the send.
externalCampaignIdstringNoGroups sends into one campaign. When omitted, an ID is generated from the mode and the current month.
dialogueInsertsstringNoInstructions the avatar receives to continue the conversation after this message.
expireAtstringNoCampaign 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

NameModesTypeRequiredDescription
fixedMessageFixedstringYesText with placeholders in braces, for example Hi {name}, your bill of {amount} is due {dueDate}.
templateTemplate, AI TemplatestringYesName of an approved template in your WhatsApp account.
data[].templateParamsTemplatestring[]When the template has variablesValues for the template variables, in order. The count must match the template, otherwise that message fails during sending.
generalInstructionsAI, AI TemplatestringYesWhat the avatar should write, for example the goal and tone of the message.
pauseConversationAI, AI TemplatebooleanNoWhen true, the conversation is paused after the send.
channelFixed, AIstringNowhatsapp (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. ..."
  }
}
FieldDescription
trackingIdID of the campaign that groups this send.
summary.totalItemsItems received.
summary.validItemsItems with content, after empty ones were removed.
summary.skippedItemsEmpty items that were ignored.
summary.queuedItemsMessages queued for sending.
summary.failedItemsItems rejected before queuing, for example a Teams item without e-mail.
processedItems[].statusqueued or failed. When failed, message says why.
timeProcessing time in milliseconds.

The message texts are in Portuguese.

Errors

CodeWhen
400Missing required field, template not found, pix sent to a template without the PIX button, or channel: "teams" with a template mode.
401The token does not resolve to an account.
500Unexpected 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.

NameTypeRequiredDescription
codestringYesPIX copy-and-paste code.
amountstringYesAmount in reais, for example "149,90".
merchantNamestringYes, here or in the top-level pixReceiver name.
keystringYes, here or in the top-level pixReceiver PIX key.
keyTypestringYes, here or in the top-level pixCPF, CNPJ, EMAIL, PHONE or EVP.
referenceIdstringNo1 to 35 characters: letters, numbers, _, . and -.
descriptionstringNoUp 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.

NameTypeRequiredDescription
phonesstring[]Yes, or dataNumbers to check.
dataarrayYes, or phonesSame shape as a send: [{ "phone": "..." }].
defaultCountrystringNoCountry 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": []
  }
}
FieldDescription
results[].hasAlerttrue when a person should review this number before the send.
results[].autoResolvabletrue when the send will reuse the existing validated contact on its own. No action needed.
results[].matchTypeexact, 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[].recommendationuse_existing, review_manual or null.
results[].recommendedPhoneThe form to use when the recommendation is use_existing.
results[].candidatesContacts found with either form. validated means WhatsApp confirmed the number.
results[].descriptionExplanation in Portuguese.
skippedNumbers that are invalid or not Brazilian. The 9th digit check does not apply to them.

Previous

Partners

Next

Tickets