Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/divideprojects/docker-telegram-bot-api
Auto build repository for 🐳 docker image of telegram-bot-api using Github Actions
https://github.com/divideprojects/docker-telegram-bot-api
bot docker telegram telegram-api telegram-bot telegram-bot-api
Last synced: 3 months ago
JSON representation
Auto build repository for 🐳 docker image of telegram-bot-api using Github Actions
- Host: GitHub
- URL: https://github.com/divideprojects/docker-telegram-bot-api
- Owner: divideprojects
- License: mit
- Created: 2021-10-15T10:00:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T07:52:18.000Z (3 months ago)
- Last Synced: 2024-07-29T19:38:17.426Z (3 months ago)
- Topics: bot, docker, telegram, telegram-api, telegram-bot, telegram-bot-api
- Language: Dockerfile
- Homepage:
- Size: 56.6 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# docker-telegram-bot-api
This is an unofficial docker image for [tdlib/telegram-bot-api](https://github.com/tdlib/telegram-bot-api)
You can use this image to create a local [Local Bot API Server](https://core.telegram.org/bots/api#using-a-local-bot-api-server) for [telegram bots](https://core.telegram.org/bots)
## Quick reference
Before start, you will need to obtain `api-id` and `api-hash` as described in [Telegram's Official Documentation](https://core.telegram.org/api/obtaining_api_id) and specify them using the `TELEGRAM_API_ID` and `TELEGRAM_API_HASH` environment variables.
And then to start the Telegram Bot API all you need to run the following command:
```
docker run -d -p 8081:8081 --name=telegram-bot-api --restart=always -v telegram-bot-api-data:/var/lib/telegram-bot-api -e TELEGRAM_API_ID= -e TELEGRAM_API_HASH= divideprojects/docker-telegram-bot-api:latest
```## How to use?
### Set the Environmental VariablesContainer can be configured via environment variables
- `TELEGRAM_API_ID`, `TELEGRAM_API_HASH`: Reuired for Telegram API access, can be obtained at https://my.telegram.org as described in https://core.telegram.org/api/obtaining_api_id
- `TELEGRAM_STAT`: Enable statistics HTTP endpoint.
Usage: `-e TELEGRAM_STAT=true -p 8082:8082` and then check that `curl http://:8082` returns server statistic- `TELEGRAM_FILTER`: "/". Allow only bots with 'bot_user_id % modulo == remainder'
- `TELEGRAM_MAX_WEBHOOK_CONNECTIONS`: default value of the maximum webhook connections per bot
- `TELEGRAM_VERBOSITY`: log verbosity level
- `TELEGRAM_LOG_FILE`: Filename where logs will be redirected (By default logs will be written to stdout/stderr streams)
- `TELEGRAM_MAX_CONNECTIONS`: maximum number of open file descriptors
- `TELEGRAM_PROXY`: HTTP proxy server for outgoing webhook requests in the format http://host:port
- `TELEGRAM_LOCAL`: allow the Bot API server to serve local requests
## Start with persistent storage
Server's working directory is `/var/lib/telegram-bot-api` so if you want to persist the server data, you can mount this folder as volume:
```
-v telegram-bot-api-data:/etc/telegram/bot/api
```## Usage via docker stack deploy or docker-compose
```yaml
version: '3.8'services:
telegram-bot-api:
image: divideprojects/docker-telegram-bot-api:latest
environment:
TELEGRAM_API_ID: ""
TELEGRAM_API_HASH: ""
# you can also configure other env variables here
volumes:
- telegram-bot-api-data:/var/lib/telegram-bot-api
ports:
- 8081:8081volumes:
telegram-bot-api-data:
```# Credits:
These repositories helped us make this!
- [bots-house](https://github.com/bots-house/docker-telegram-bot-api)
- [aiogram](https://github.com/aiogram/telegram-bot-api)