Sending messages

Send a message

POST /v1/bot/messages accepts only chat_id values assigned to the authenticated bot. content can include text, Markdown, media, menu, and keyboard.

curl -X POST https://chat.wokey.pro/_keychat/v1/bot/messages \
  -H "Authorization: Bearer $KEYCHAT_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"<uuid>","content":{"text":"Done"},"idempotency_key":"job-42"}'

Idempotency

Use a unique idempotency_key for retryable operations. Reusing it returns the original event without posting a duplicate.

Replace a message

replace_event_id updates an earlier message sent by this bot, including its keyboard. This is useful for replacing “Working…” with the result.

Bot is responding

Clients may show the standard animated ellipsis while work is in progress. Represent failures and service states as system messages.

SDK practice

Use Markdown only for trusted or escaped text. Persist the same idempotency_key across retries until the operation reaches a final state.

A bot may edit only its own messages. replace_event_id keeps the message position; reply_to_event_id creates a regular reply.

Usage examples

await bot.sendMessage({
  chat_id: chatId,
  content: { text: '**Ready**', format: 'markdown' },
  idempotency_key: crypto.randomUUID()
});
© 2026. Key Chat.