ctx.poll() ·
poll votes (bot.on('poll')) ·
bot.send() outside a handler ·
ctx.react() ·
terminal simulator :click
Prerequisites
Node.js 22.12 or newer and a folder with"type": "module" (see
Getting started). Then install:
The complete bot
Sample transcript
Captured withnpx botmesh dev bot.js; :click 2 votes for the second
option of the last poll:
How it works
ctx.poll(question, options, multiSelect?)sends a native poll. Polls are native on WhatsApp via Baileys and on Telegram; the WhatsApp Cloud API has none (ctx.poll()rejects withUnsupportedContentErrorthere, use buttons, see the Menu bot).- Votes are events, not messages.
bot.on('poll')receives{ ref, senderId, options }, whereoptionsholds every option with itsvotesandvoters. Changing or withdrawing a vote fires it again. bot.send(chatId, text)sends outside a handler;vote.ref.chatIdis the chat where the poll was voted.ctx.react(emoji)reacts to the incoming message. Channels without reactions resolve{ skipped: true }instead of failing.- On WhatsApp the votes are end-to-end encrypted: the provider decrypts them, but only for polls this process sent or saw (see Poll votes).
Run it on WhatsApp or Telegram
node bot.js prints a QR: scan it in WhatsApp → Linked devices. On
Telegram, install @botmesh/telegram and swap the provider as shown in
Or connect Telegram; its polls
are sent non-anonymous so the votes reach the bot.
Next steps
- Media replies: images, documents, locations and contacts
- Menu bot: buttons on channels without polls
- Messages & media: every send method