1. Make a bot
- Sign in to KEZAYO Chat and search
@botmaker_bot. - Send
/newbot, accept the rules, then choose a name and a username that ends inbot(5–30 characters, for exampleTaxHelperBot). - You get a token like
123:AbC…. Treat it as a password. The message deletes itself after 10 minutes; if you lose the token, send/newtoken @yourbot(the old one stops working).
Other commands: /mybots, /setdescription @yourbot, /deletebot @yourbot, /cancel. You can have up to 5 bots.
Bots never message anyone first and only write in chats a person opened. A person can block a bot. Your bot sees the person’s display name, @username (if they have one) and a code that identifies them to your bot only — never their e-mail, phone number or KEZAYO account id.
2. The Bot API
Base URL: https://kezayo.com/botapi/<token>/<method>. Use POST with a JSON body (or GET with a query string). Every reply is { "ok": true, "result": … } or { "ok": false, "error_code": 403, "description": "…" }.
| Method | Parameters | What it does |
|---|---|---|
getMe | — | The bot’s id, name and username. |
sendMessage | chat_id, text (up to 4096 characters), reply_to_message_id?, client_msg_id? | Sends a message. The same client_msg_id is sent only once. |
editMessageText | chat_id, message_id, text | Edits a message the bot sent. |
deleteMessage | chat_id, message_id | Deletes a message the bot sent. |
getUpdates | offset?, limit? (up to 100), timeout? (seconds, up to 25) | Messages people sent. Pass offset = last update_id + 1 to confirm the earlier ones. |
setWebhook | url (https), secret_token? | Send updates to your server instead of waiting for getUpdates. |
setMyCommands | commands: [{command, description}] (up to 50) | The “/” menu people see in your chat. getMyCommands and deleteMyCommands read and clear it. |
editMessageReplyMarkup | chat_id, message_id, reply_markup? | Change the buttons of a message (leave reply_markup out to remove them). |
answerCallbackQuery | callback_query_id, text? | Acknowledge a button tap. (The text is shown to the person in a later release.) |
deleteWebhook / getWebhookInfo | — | Remove the webhook / see it and the number of waiting updates. |
A small bot that repeats what people write (Node 18 or newer):
const API = `https://kezayo.com/botapi/${process.env.BOT_TOKEN}`;
const call = (m, b) => fetch(`${API}/${m}`, {
method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(b),
}).then((r) => r.json());
let offset = 0;
for (;;) {
const { result = [] } = await call('getUpdates', { offset, timeout: 25 });
for (const u of result) {
offset = u.update_id + 1;
if (u.message?.text) await call('sendMessage', { chat_id: u.message.chat.id, text: `You said: ${u.message.text}` });
}
}3. Updates
Each message a person sends arrives as an update. chat.id is what you pass back as chat_id. Only text messages are delivered for now.
{ "update_id": 42,
"message": { "message_id": 7,
"chat": { "id": "<chat id>", "type": "private" },
"from": { "id": "u3f9a…", "first_name": "Asha", "username": "asha", "is_bot": false },
"date": 1795000000, "text": "/start" } }Updates wait up to 24 hours. getUpdates and a webhook cannot be used at the same time (409).
5. Webhooks
Set setWebhook to an https address. Your server gets a POST with the update as JSON and must answer 2xx within 10 seconds. Updates arrive in order; a failure is retried after 5 s, 10 s, 20 s … up to 1 hour. The header X-Kezayo-Bot-Secret carries your secret_token, so you can check the call is ours. Addresses on private or internal networks are refused.
6. Limits and errors
- Up to 20 messages per second across all chats (bursts of 30), and 1 per second in one chat (bursts of 20). A 429 reply tells you how long to wait (
parameters.retry_after). - 401 wrong or replaced token · 403 the person blocked the bot, the bot is not in that chat, or it was disabled · 404 unknown method · 409 a webhook is set · 413 too large · 429 slow down.
7. Rules
- No spam. People must choose to chat with your bot.
- Do not pretend to be KEZAYO, a person or a company.
- Collect only what your bot needs, and keep it safe.
- Nothing illegal, harmful or deceptive.
- You are responsible for your bot. KEZAYO may disable any bot that breaks these rules. Questions: [email protected].