A Telegram bot that downloads Amazon Music tracks and sends them directly to your chat — supports AAC, ALAC, and FLAC (24-bit / 192kHz).
This is an unofficial, educational project. It is not affiliated with, endorsed by, or connected to Amazon or Amazon Music in any way. Use at your own risk and make sure you're complying with Amazon's Terms of Service.
You need to buy API access from Amazon before this bot will do anything.
👉 Amazon Music Developer Program
Once you have access, set the base URL as API_BASE in your environment variables.
Send the bot any Amazon Music track link and it downloads the track and sends it back to you as an audio file. It handles AAC, ALAC, and FLAC depending on what the API returns. If the track has a decryption key, ffmpeg takes care of that automatically.
It also logs new users and downloads to a private Telegram channel if you set one up, and keeps track of unique users in MongoDB.
├── amazon_music_bot.py # bot logic
├── config.py # environment variables
├── mongodb.py
├── requirements.txt
├── Dockerfile
├── Procfile # Heroku / Koyeb
├── heroku.yml # Heroku Docker deployment
├── railway.toml # Railway
├── render.yaml # Render
├── nixpacks.toml # Railway nixpacks / Koyeb fallback
├── runtime.txt # Python version for Heroku
└── .env.example
| Variable | Required | Description |
|---|---|---|
API_ID |
✅ | Telegram App ID from my.telegram.org |
API_HASH |
✅ | Telegram App Hash from my.telegram.org |
BOT_TOKEN |
✅ | Bot token from @BotFather |
API_BASE |
✅ | Your Amazon Music API base URL |
MONGO_URI |
✅ | MongoDB connection string |
DB_NAME |
❌ | Database name (default: amzn_music_bot) |
LOG_CHANNEL |
❌ | Numeric ID of your log channel (default: 0 = disabled) |
This bot needs ffmpeg, so Docker is the cleanest option across all platforms.
git clone https://github.com/LastPerson07/Amazon-Music-Telegram-Bot.git
cd Amazon-Music-Telegram-Bot
cp .env.example .env
# fill in .env
docker build -t amzn-bot .
docker run --env-file .env amzn-botOr without Docker (requires ffmpeg installed on the system):
pip install -r requirements.txt
# export your env vars, then:
python amazon_music_bot.py- Fork the repo
- Create a new project on Railway from your fork
- Add all environment variables in the Railway dashboard
- It'll pick up the
Dockerfileviarailway.tomland deploy automatically
- Fork the repo
- Create a new Background Worker on Render
- Point it at your fork — Render will use
render.yaml - Fill in the environment variables and deploy
Heroku uses heroku.yml to build from Docker (needed for ffmpeg):
heroku login
heroku create your-app-name
heroku stack:set container -a your-app-name
heroku config:set API_ID=... API_HASH=... BOT_TOKEN=... API_BASE=... MONGO_URI=...
git push heroku main
heroku ps:scale worker=1 -a your-app-name- Create a new app on Koyeb
- Connect your GitHub repo
- Koyeb will auto-detect the
Dockerfile - Set environment variables in the Koyeb dashboard and deploy
- Start the bot with
/start - Paste an Amazon Music track link, e.g.:
https://music.amazon.in/albums/B0XXXXXXXX?trackAsin=B0YYYYYYYY - The bot downloads the track and sends it back as an audio file
Only direct track links work. Search URLs and API URLs are rejected.
- The bot completely depends on your
API_BASEendpoint — if the API is down or your key expires, nothing will work - Track availability varies by region due to Amazon's licensing
- Keep your
.envfile out of version control — add it to.gitignore - The
LOG_CHANNELshould be a private channel only you can access
Built by Nick and Abhi (tenka).Dev-LastPerson07 Nick did most of the work on this — if it's useful to you, just give credit where it's due.