Node.js module to interact with official [Telegram Bot API](https://core.telegram.org/bots/api). A bot token is needed, to obtain one, talk to [@botfather](telegram.me/BotFather) and create a new bot.
Both request method to obtain messages are implemented. To use standard polling, set `polling: true`
on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a valid (not self signed) SSL certificate.
```sh
npm install node-telegram-bot-api
```
@ -27,99 +24,114 @@ There are some other examples on [examples](https://github.com/yagop/node-telegr
* * *
## Class: TelegramBot
NodeJS class for Telegram Bot API.
## TelegramBot
Both request method to obtain messages are implemented. To use standard polling, set `polling: true`
on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a valid (not self signed) SSL certificate.
Emmits `message` when a message arrives.
See: https://core.telegram.org/bots/api
### Params:
Support for WebHooks and long polling. Emits `message` when message arrives.
* **String***token* Bot Token
* **Object** *[options]*
* **Boolean|Object***[options.polling=false]* Set true to enable polling
* **String|Number***[options.polling.timeout=4]* Polling time
* **Boolean|Object***[options.webHook=false]* Set true to enable WebHook
* **String***[options.webHook.key]* PEM private key to webHook server
* **String***[options.webHook.cert]* PEM certificate key to webHook server
### TelegramBot.getMe()
## getMe()
Returns basic information about the bot in form of a `User` object.
**Returns**: `Promise`
### Return:
### TelegramBot.setWebHook(url)
* **Promise**
Specify a url to receive incoming updates via an outgoing webHook.
## setWebHook(url)
**Parameters**
Specify a url to receive incoming updates via an outgoing webHook.
**url**: `String`, URL
### Params:
* **String***url* URL
###TelegramBot.getUpdates(timeout, limit, offset)
## getUpdates([timeout], [limit], [offset])
Use this method to receive incoming updates using long polling