Telegram bot development tool for triggering localhost / non-https hook with 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<bot-token>/getWebhookInfo
if not so, you can remove your active webhook by accessing https://api.telegram.org/bot<bot-token>/setWebhook?url=
$
npm install telehook --save
or install as global to use Telehook CLI
$
npm install -g telehook
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();
})
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.
telehook run <botToken> <hookUrl>
-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
MIT