telegram-promise

Simple Telegram Bot API

Usage no npm install needed!

<script type="module">
  import telegramPromise from 'https://cdn.skypack.dev/telegram-promise';
</script>

README

telegram-promise Build Status

This is a simple implementation of Telegram Bot API.

Key features:

  • ES2015
  • Promise based
  • Easy customizable
  • Bot API 2.0

Supports Node.js versions greater than 4.

What isn't included:

  • Handling updates (webhook or long polling). It is business of your application.

Installation

$ npm install telegram-promise --save

Usage

const TelegramBotAPI = require('telegram-promise');

const api = new TelegramBotAPI(ACCESS_TOKEN);

api.getMe()
  .then(res => {
    console.log(res.result);
  })
  .catch(err => {
    console.error(err);
  });

api.sendPhoto({
  chat_id: CHAT_ID,
  photo: fs.createReadStream('cats.png'),
})
  .then(res => {
    console.log('Done!');
  })
  .catch(err => {
    console.log('Error:', err);
  });

API

Module API follows the official Telegram Bot API: https://core.telegram.org/bots/api

Implemented API verion: April 9, 2016 Bot API 2.0

All methods have the last parameter options. It can be used for request customization. See more: node-fetch.

More info

License

MIT