Telegram bot API for easy access on typescript/javascript
npm install gl.telegram-bot- Must have
- How to create a telegram bot
- Get started
- Installation
- Creating instance of bot
- Bot Actions
- sendMessage
- getUpdates
- getGroupIDs
Using npm:
``bash`
$ npm install gl.telegram-bot
`typescript
import TelegramBot from "gl.telegram-bot";
const botInstance = new TelegramBot('1234567:ASJHR24-93145uASJHF-ASDIRFJ3158');
`
This action sends a message to an individual group
`typescript
// send to 1 group id
botInstance.sendMessage('test message', '-100123456789');
// send to multiple groups
botInstance.sendMessage('test message', ['-100123456789', '-100987654321']);
`
`typescript
const updates = await botInstance.getUpdates();
// this is
console.log(updates);
`
`typescript
const groupIDs = await botInstance.getGroupIDs();
// this is
console.log(updates);
``