Node-telegram-bot-api: Dockerizing Telegram Bot

Created on 20 Nov 2018  路  2Comments  路  Source: yagop/node-telegram-bot-api

Question

In order to dockerize the telegram bot, I have to define which port I want to expose. But the telegram docs don't specify what port polling uses. Has anyone successfully dockerized it?

question

Most helpful comment

I don't think exposing a port is needed for polling. In polling, telegram bot api only answers to your requests. In webhook, instead, telegram bot api sends you updates, so there you need to expose port 443 (HTTPs).

All 2 comments

I don't think exposing a port is needed for polling. In polling, telegram bot api only answers to your requests. In webhook, instead, telegram bot api sends you updates, so there you need to expose port 443 (HTTPs).

I run around 6 dockerized bots on node-telegram-bot-api right now. All on polling right now. You don't need to expose anything.

Polling means your script opens a normal http request to Telegram servers and that connection never ends. It has no connection timeout (should have data timeout though, after which it reconnects). Telegram servers just "sleeps" on your connection and when something happens - it just flush that information into opened connection. When you're sending messages to Telegram servers - another http connection opens up, sends the data and closes.

This isn't most performent way to do things, but it's the easiest one, because... you don't have to expose any ports or manage a http server :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Panthro picture Panthro  路  3Comments

jacopocappelli1989 picture jacopocappelli1989  路  4Comments

saeedhei picture saeedhei  路  4Comments

Rezania815 picture Rezania815  路  3Comments

mbrammer picture mbrammer  路  3Comments