Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Examples

Runnable TypeScript examples for node-telegram-bot-api.

Example What it shows
polling.ts Long-polling bot: onText commands, sending files, inline keyboards, callback_query
webhook/express.ts Receiving updates through an Express route
webhook/https.ts Built-in webhook server with a self-signed certificate
webhook/heroku.ts Webhook behind Heroku's SSL termination
game/game.ts HTML5 games via sendGame + answerCallbackQuery

Running

The examples are written in TypeScript and run directly with tsx — no build step:

export TELEGRAM_TOKEN="<token from @BotFather>"
npx tsx examples/polling.ts

The webhook and game examples additionally need Express:

npm i express
npx tsx examples/webhook/express.ts

In your own project, import from the package name:

import TelegramBot from 'node-telegram-bot-api';

(The examples use that same import; within this repo it resolves to the local build via the package's exports map.)