Telegram Bot Bootstrap

A bootstrap for Telegram bot with directly deployable sample bot and JS-wrapped API methods. You can use all methods available in the Telegram API directly, and send any supported media (we serialize the formData for you to send over HTTP).

See the full API documentation of this project.


Do either of

Either way you’ll get a module with the Telegram bot API wrapped in Node, and a bootstrapped, deploy-ready project.

If you haven’t already, get a bot from BotFather and remember your bot token!


  • Wrapped API methods take either a JSON object or multiple parameters.
  • Auto serialization for HTTP formData: send photos/keyboards/media directly.
  • API methods return promises (uses q) for easy chaining and flow control.
  • Complete documentation and examples usages.
  • Bootstrapped and directly deployable bot.

Usage: only the API

See the full API documentation of this project.

API.js contains the Telegram Bot API wrapped in Node. The methods will return a promise for easy chaining, and will take either a whole JSON, or multiple parameters for convenience. For the latter, everything will be auto-serialized for HTTP so you don’t have to deal with any of the nasty HTTP protocol stuff.

If you wish to use just the API or test the bot methods, here’s an example

Local(not deployed yet) test bot constructor

See testbot.js for functional example.

Sending Message, Photo and all media

You’ll receive this:

Custom keyboard

You’ll get this:

Usage: Bootstrapped, Deployable Bot

See index.js for deployable app, and bot.js to customize bot commands.

We distinguish the bot from the API: bot.js extends API.js, and will be the deployed component.

This whole project is bootstrapped and deploy-ready: all the details of HTTP and server stuff taken care of for you. I deploy this git project onto my Heroku and voila, my bot is alive.


In addition to the token, you’ll need a webhookUrl. If you deploy your Node app to Heroku, then the webhookUrl is simply your Heroku site url. Set both of them in the .env file:

Leave a Reply

Your email address will not be published. Required fields are marked *