WELCOME trigger ·
text and regex triggers ·
ctx.pass() ·
slash commands ·
catch-all ·
terminal simulator
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 --name Ana:
How it works
WELCOMEfires on the first message of each user (per chat in a DM, per participant in a group) and runs before every other trigger.ctx.pass()lets the same message continue, so “Hí” also reaches thehihandler./resetre-arms the welcome.- Text triggers compare the whole message after normalizing it
(lowercase, accents stripped, spaces collapsed):
'hi'matches “Hí ” but not “hi there”. A list matches any of its entries. - A regex matches anywhere in the text;
ctx.bodykeeps the original text, so the echo keeps the user’s casing. slashCommandsPluginadds/start,/help,/reset,/cancel,/idand/ping;greetingreplaces the text of/startand/help.bot.onMessage()is the catch-all: it only runs when nothing else handled the message.
Run it on WhatsApp or Telegram
node bot.js prints a QR: scan it in WhatsApp → Linked devices. For
Telegram, install @botmesh/telegram and swap the provider as shown in
Or connect Telegram; the
factory does not change.
Next steps
- FAQ bot: more trigger forms (contains, regex, lists)
- Special triggers:
WELCOME, message types and calls - Testing: assert these replies with
createTestBot