Open source project that provide simple HTTP API to upload and download files to/from Telegram.
Use directly MTProto protocol to upload files up to 2GB with a simple bot token.
Based on NestJS framework.
- Upload any files
- Download uploaded files
- Resend message with file
- node
- postgres
- pnpm
Deploy ready container avaiable on DockerHub
- Create Telegram application
- Create Telegram bot with BotFather
- Install or run in container PostgreSQL
- Create Telegram chat for bot uploads and get chat id by guide
env | required | description |
---|---|---|
DATABASE_URL | yes | Database connection URL |
TELEGRAM_API_ID | yes | Application ID from your Telegram App |
TELEGRAM_API_HASH | yes | Application hash from your Telegram App |
TELEGRAM_BOT_TOKEN | yes | Telegram bot token |
TELEGRAM_CHAT_ID | yes | Chat ID to upload files |
-
Copy
.env.example
, rename to.env
and setup all variables -
Install dependencies
pnpm install
-
Build project
pnpm build:prod
-
Start application
pnpm start:prod
-
Open
localhost:3000
and seeok
message (default port: 3000)
Request:
Accept binary file
Require Content-Type
and Content-Length
headers.
Optionally can be passed X-Filename
header to save filename to uploaded file. Saved file name will be used when downloading.
Max file size - 2000MiB
Response:
Return JSON serialized FileEntity
Request:
Require id of uploaded file in url\
Response:
Return binary file stream with Content-Type
and timestamp in filename.
OR use custom filename if wass passed X-Filename
header on upload.
Request:
Require id of uploaded file in url and JSON body:
{ "peerId": "myTgUsername", "message": "optional" }
Response:
Nothing
- Fork and clone this repository
- Commit your changes
- Create a pull request to
master
branch
Or, just send us an issue for reporting bugs or ask questions and share your ideas, etc in discussions.