Telegram bot
A Telegram bot that replies to messages, always on. It asks Telegram for new messages itself, so it needs no public URL.
Get it
$ npx dukoi init telegram-bot It makes a telegram-bot folder and deploys it. On the phone instead: Try a template → Telegram bot → Deploy.
You need a token
- In Telegram, message @BotFather and send
/newbot. - Pick a name. BotFather gives you a token like
123456:ABC-def….
init asks for it and saves it on the phone as a setting, never in the folder. To change it later:
$ npx dukoi env set TELEGRAM_BOT_TOKEN=123456:ABC... What you get
Message your bot. It answers /start and repeats anything else you send.
Make it yours
Four files. You only need to touch one.
- bot.js
- The replies. Edit this one.
- dukoi.json
- Tells Dukoi it opens no port
- package.json
- Its name. No packages needed.
- README.md
- How to run it, in five minutes
Change the /start reply in bot.js:
if (text === '/start') {
return 'Welcome to my bot 👋'
} Then deploy again. The bot keeps its token.
$ npx dukoi deploy