Skip to content

zhecky/telegram-webhook-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-webhook-proxy

Telegrap bot proxy for local webhook.

Useful for local bot developing when need to use webhooks. But it's just a little difficult when IP is not public accessable or Firewall is so angry. Here is a way to use getUpdates, but it's also bad show (try to realise it on PHP or when request-on-response are used).

This tiny programm will helps You. It just getting update using getUpdates method (don't panic: long poll is used) and sends it to hebhook You're specified. Error retrying and request-on-response are honored.

Steps to run:

  1. Create dir
mkdir webhookproxy && cd "$_"
  1. Clone repo
git clone https://github.com/zhecky/telegram-webhook-proxy.git .
  1. Load dependencies
npm install
  1. Configure your bot api and callback
nano params.yml
  1. Run
node main.js

params.yml description

source

botToken

Current telegram bot token

pollingTimeout

Telegram long polling timeout

printReceivedUpdates

Pretty print received update's json to stdout

destination

webhookUrl

Local or another webhook url to post received updates

retryOnError

If webhook invoke fails, that update will not be "acknowledged", and retried again

retryOnErrorTimeout

Sleep time before retry after error (if retryOnError enabled)

nextUpdateTimeout

Interval between webhook invoged for each update. Useful when event queue is large and webhook backend is weak/slow etc

printWebhookResponse

Print webhook raw body to stdout

apiCallAfterWebhook

If enabled, request-on-response will be executed. Non-json ansver or error during API call is not reason for retry (just like telegram do)

printAPIResultAfterWebhook

Print request-on-response api call result to stdout