-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Labels
enhancementThis issue/pr proposes/adds a feature to the botThis issue/pr proposes/adds a feature to the bot
Description
About this suggestion
While long polling is used in the Guard, switching to webhooks can make the bot faster and can even catch up things missed during downtimes. That means, we need to pick a module that we can use for handling requests from Telegram. Express.js maybe a good choice, but others are available.
It should be configurable whenever they want to go back to polling by setting NODE_ENV
variable to development
. If they want to use webhooks by default, they need to configure config.serverApi.hostUrl
and config.serverApi.tgWebhookEndpoint
(defaults to /api/telegram/webhookEndpoint
).
Why going to webhooks?
- Fewer CPU cycles = faster response time
- Bot can catch up things missed during downtimes. 48 hours is good for small networks, but how about large networks having downtimes longer than the time window?
- More secure because Telegram knows where it sends webhook requests (unless somebody knew the API token or had SSH access). Having SSL stuff on your bot server domain is required to keep hackers from intercepting Telegram secrets.
- We're now adding API stuff to our bot. So people can fetch global bans and integrate it with their bot, but we should add some layers of authentication and protection against spammers.
Known Issues
- Bot leaves even the bot master/s added it to the group. See in Telegram and backread.
- The logs firing up some errors.
chat
is undefined for some reasons inutils/tg.js
. See also in Telegram for details and its workaround.
FAQs
Should I blame Telegraf for these issues listed above?
Maybe, but the best way is to create an issue in their Issue Tracker so they can fix it.
Metadata
Metadata
Assignees
Labels
enhancementThis issue/pr proposes/adds a feature to the botThis issue/pr proposes/adds a feature to the bot