Docker should be installed.
- Get
api_id
andapi_hash
from telegram. - Get the
bot_token
from BotFather Telegram Bot. - Get the
webhook_url
from the Setup of your Bot Webhook Listener - Get the
bot_server_base_url
either using noip or ngrok. - Clone this repo
git clone https://github.com/chitranjan-gupta/telegram-bot-server
- Go to directory telegram-bot-server
cd telegram-bot-server
- Build the docker image
docker build -t telegram .
- Make GET request to
https://api.telegram.org/bot[BOT_TOKEN]/logOut
replace with bot_token to logout Telegram Cloud API Server. - Run the docker image
docker run -p 80:80 telegram --api-id [API_ID] --api-hash [API_HASH] --http-port 80
- Make GET request to
https://[BOT_SERVER_BASE_URL]/bot[BOT_TOKEN]/setWebhook?url=[WEBHOOK_URL]/&drop_pending_updates=true
replace with bot_server_base_url, bot_token and webhook_url to set webhook url to get updates from the bot.
If you want to migrate to different server you have to all the steps from above but before that you have do this
- Make GET request to
https://[BOT_SERVER_BASE_URL]/bot[BOT_TOKEN]/getWebhookInfo
replace with bot_server_base_url and bot_token to check about your webhook url. - Make GET request to
https://[BOT_SERVER_BASE_URL]/bot[BOT_TOKEN]/deleteWebhook?drop_pending_updates=true
replace with bot_server_base_url and bot_token to remove your webhook url set previously. - Make GET request to
https://[BOT_SERVER_BASE_URL]/bot[BOT_TOKEN]/close
replace with bot_server_base_url and bot_token to stop the bot instance. - Make GET request to
https://[BOT_SERVER_BASE_URL]/bot[BOT_TOKEN]/logOut
replace with bot_server_base_url and bot_token to logout from Local API Server.
- https://core.telegram.org/bots/api
- https://github.com/tdlib/telegram-bot-api
- https://api.telegram.org/bot[BOT_TOKEN]/getWebhookInfo
- https://api.telegram.org/bot[BOT_TOKEN]/setWebhook?url=[WEBHOOK_URL]&drop_pending_updates=true
- https://api.telegram.org/bot[BOT_TOKEN]/deleteWebhook?drop_pending_updates=true
- https://api.telegram.org/bot[BOT_TOKEN]/close