Send your currently playing Spotify tracks directly to Telegram. The bot automatically handles message updates to avoid spam.
- 🎵 Share current Spotify tracks to Telegram
- 🔄 Auto-updates existing messages instead of creating new ones
- 🎧 Sends audio file if track not previously shared
- ⚡ Simple and lightweight
- Spotify API credentials
- Telegram Bot Token
- Docker and Docker Compose plugin
To run this app, we have several steps that we need to do in order:
Visit your Spotify developers dashboard then select or create your app. Note down your Client ID, Client Secret, and Redirect URI in a convenient location to use in Step 2.
Visit the following URL after replacing $CLIENT_ID
, $SCOPE
, and $REDIRECT_URI
with the information you noted in Step 1.
https://accounts.spotify.com/authorize?response_type=code&client_id=$CLIENT_ID&scope=user-read-currently-playing&redirect_uri=http://localhost:8081
I was redirected to the following URL because my redirect URI was set to http://localhost:8081. In place of $CODE
there was a very long string of characters. Copy that string and note it down for use in Step 4.
http://localhost:8081/?code=$CODE
Running the following CURL command will result in a JSON string that contains the refresh token, in addition to other useful data. Again, either replace or export the following variables in your shell $CILENT_ID
, $CLIENT_SECRET
, $CODE
, and $REDIRECT_URI
.
curl -d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET -d grant_type=authorization_code -d code=$CODE -d redirect_uri=$REDIRECT_URI https://accounts.spotify.com/api/token
The result will be a JSON string similar to the following. Take the refresh_token
and save that in a safe, private place. This token will last for a very long time and can be used to generate a fresh access_token
whenever it is needed.
Put your client_id
, client_secret
and refresh_token
in .env
cp .env.example .env
vim .env
Now you can run wave with docker compose
docker compose up -d
You can see current listening music from container logs
docker logs -f wave