https://github.com/qutek/telehook
Trigger localhost / non-https telegram hook with getUpdates
https://github.com/qutek/telehook
npm-package telegram telegram-bot telegram-cli
Last synced: about 2 months ago
JSON representation
Trigger localhost / non-https telegram hook with getUpdates
- Host: GitHub
- URL: https://github.com/qutek/telehook
- Owner: qutek
- License: mit
- Created: 2018-06-24T15:02:41.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2024-02-29T20:23:22.000Z (almost 2 years ago)
- Last Synced: 2025-10-05T14:46:39.160Z (4 months ago)
- Topics: npm-package, telegram, telegram-bot, telegram-cli
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/telehook
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Telehook.js
Telegram bot development tool for triggering localhost / non-https hook with [getUpdates](https://core.telegram.org/bots/api#getupdates)
It will listen for incoming updates from Telegram.org and if there any updates it will forward the messages to your local webhook.
Please make sure there is no active webhook registered on your bot, you can check it here `https://api.telegram.org/bot/getWebhookInfo`
if not so, you can remove your active webhook by accessing `https://api.telegram.org/bot/setWebhook?url=`
## Installation
>$ `npm install telehook --save`
or install as global to use Telehook CLI
>$ `npm install -g telehook`
## Example
```js
const telehook = require('telehook');
var hook = telehook('YOUR_BOT:API_KEY', 'http://localhost/your-hook/', {
interval: 1000,
timeout: 0
});
hook.on('data', function(data){
console.group('RECEIVED');
console.log(data);
console.groupEnd();
})
hook.on('error', function(error){
console.group('ERROR');
console.error(error);
console.groupEnd();
})
hook.on('forwarded', function(data){
console.log('forwarded');
})
hook.on('forward.error', function(error){
console.group('FORWARD ERROR');
console.error(error);
console.groupEnd();
})
```
## CLI
Make sure you have install Telehook CLI with
>$ `npm install -g telehook`
use command run and pass the bot api key as well as the hook ur.
```sh
telehook run
```
### Options
- `-i, --interval` *(To set the interval for checking updates, default to 1000 (1 second)*
- `-t, --timeout` *(To set the timout request while checking updates, default to 0*
## License
MIT