Bots

Create bots that look and behave like regular Atlayo chat contacts. People find them by @username, press START, and instead of typing they get a menu of buttons you define. Your server talks to the bot through a simple HTTP API (Telegram-compatible shape). Works in the Atlayo app, chat.atlayo.com and the desktop app.

Jump to API documentation

No bots yet

Create your first bot - it takes less than a minute.

API documentation

Every request goes to https://atlayo.com:8443/bot<TOKEN>/<method>. Use GET or POST; parameters may be sent as a JSON body, application/x-www-form-urlencoded or in the query string. Every response is JSON: {"ok":true,"result":...} on success or {"ok":false,"error_code":400,"description":"..."} on failure.

1. Quick start

TOKEN="123:AbCdEf..."
curl https://atlayo.com:8443/bot$TOKEN/getMe
curl https://atlayo.com:8443/bot$TOKEN/getUpdates?timeout=30

A user opens your bot (search for @username in Atlayo Chat), taps START and your bot receives a /start message. Bots can only write to users who wrote to them first, and users can block a bot like any other contact.

2. Receiving updates

getUpdates (long polling) - params offset, limit (1-100), timeout (0-50 s). Confirm updates by calling again with offset = last update_id + 1. Updates are stored for 24 hours. Not available while a webhook is set (error 409).

Webhook - set it in the Webhook tab or with setWebhook {url, secret_token, drop_pending_updates} (HTTPS only). Atlayo POSTs a single update as JSON; if you configured a secret it is sent in the X-Atlayo-Bot-Api-Secret-Token header. Respond 2xx. You may answer directly in the HTTP response body with {"method":"sendMessage","chat_id":...,"text":"..."}. deleteWebhook and getWebhookInfo are also available.

// message update
{"update_id": 17,
 "message": {"message_id": 981, "from": {"id": 42, "is_bot": false, "first_name": "Jana", "language_code": "cs"},
             "chat": {"id": 42, "type": "private", "first_name": "Jana"},
             "date": 1793900000, "text": "/start",
             "entities": [{"type": "bot_command", "offset": 0, "length": 6}]}}

// button press on an inline keyboard
{"update_id": 18,
 "callback_query": {"id": "cb_abc", "from": {"id": 42, ...}, "message": {...}, "chat_instance": "...", "data": "buy:coffee"}}

3. Methods

MethodParametersDescription
getMe-Basic info about the bot.
sendMessagechat_id, text (max 4096), reply_markup, reply_to_message_idSend a text message. chat_id is the chat.id / from.id you received.
editMessageTextchat_id, message_id, text, reply_markupEdit one of the bot's own messages (e.g. update a menu in place).
editMessageReplyMarkupchat_id, message_id, reply_markupChange only the inline buttons.
deleteMessagechat_id, message_idDelete a bot message.
answerCallbackQuerycallback_query_id, text, show_alert, urlAcknowledge a button press (shows a toast or an alert). Always call it so the button stops "loading".
sendChatActionchat_id, action (e.g. typing)Show "typing..." for a few seconds.
setMyCommands / getMyCommands / deleteMyCommandscommands: [{command, description}]The "/" menu of the bot.
setMyDescription / getMyDescriptiondescriptionText shown before START.
setWebhook / deleteWebhook / getWebhookInfosee aboveWebhook management.
getUpdatesoffset, limit, timeoutLong polling.

4. Replacing the text input with buttons

Attach a reply keyboard to any message. The chat input is replaced by your buttons; pressing one sends its text to your bot as an ordinary message. The keyboard stays until you send another one or {"remove_keyboard": true}.

curl -X POST https://atlayo.com:8443/bot$TOKEN/sendMessage -H 'Content-Type: application/json' -d '{
  "chat_id": 42,
  "text": "What would you like to do?",
  "reply_markup": {
    "keyboard": [[{"text": "Catalog"}, {"text": "My orders"}], [{"text": "Support"}]],
    "hide_input": true,      // default: only buttons, a small "Type a message" chip reveals the input
    "lock_input": false,     // true: user cannot type at all
    "one_time_keyboard": false,
    "input_field_placeholder": "Choose an option"
  }
}'

An inline keyboard is attached below a message. Buttons can send callback_data (max 64 bytes; you receive a callback_query), open a link with url, or copy text with copy_text.

"reply_markup": {"inline_keyboard": [[
  {"text": "Buy", "callback_data": "buy:coffee"},
  {"text": "Open site", "url": "https://example.com"},
  {"text": "Copy code", "copy_text": "PROMO2026"}
]]}

To hide the keyboard again: "reply_markup": {"remove_keyboard": true}. You can also configure a default menu in the Menu tab of the bot - it is used until your bot sends its own keyboard.

5. Example (Node.js, long polling)

const API = 'https://atlayo.com:8443/bot' + process.env.TOKEN + '/';
const call = (m, body) => fetch(API + m, {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(body || {})}).then(r => r.json());

let offset = 0;
for (;;) {
  const r = await call('getUpdates', {offset, timeout: 30});
  for (const u of r.result || []) {
    offset = u.update_id + 1;
    if (u.message?.text === '/start') {
      await call('sendMessage', {chat_id: u.message.chat.id, text: 'Welcome!',
        reply_markup: {keyboard: [[{text: 'Catalog'}, {text: 'Support'}]]}});
    } else if (u.callback_query) {
      await call('answerCallbackQuery', {callback_query_id: u.callback_query.id, text: 'Done'});
    }
  }
}

6. Limits & notes

  • Bots are regular chat contacts. Messages between a user and a bot are not end-to-end encrypted (the server has to read them to deliver them to your bot). Users see a "bot" badge.
  • Only text messages are supported at the moment. Maximum 20 bots per account.
  • Rate limits: about 30 sent messages per second per bot and about 2 per second into a single chat. Exceeding returns 429 with parameters.retry_after.
  • A bot can only write to users who started it, and never to users who blocked it.