https://github.com/0xafz/wave
Send your currently playing Spotify tracks directly to Telegram
https://github.com/0xafz/wave
Last synced: 3 months ago
JSON representation
Send your currently playing Spotify tracks directly to Telegram
- Host: GitHub
- URL: https://github.com/0xafz/wave
- Owner: 0xAFz
- License: mit
- Created: 2024-09-05T22:25:48.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-01-28T12:12:50.000Z (4 months ago)
- Last Synced: 2025-01-28T13:30:29.140Z (4 months ago)
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wave
Send your currently playing Spotify tracks directly to Telegram. The bot automatically handles message updates to avoid spam.
## Features
- 🎵 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## Running Steps
### Requirements
- Spotify API credentials
- Telegram Bot Token
- [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) pluginTo run this app, we have several steps that we need to do in order:
### 1. Get your Spotify `Client id` and `Client secret`
Visit your [Spotify developers dashboard](https://developer.spotify.com/dashboard/applications) 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.### 2. Get your access code
Visit the following URL after replacing `$CLIENT_ID`, `$SCOPE`, and `$REDIRECT_URI` with the information you noted in Step 1.```bash
https://accounts.spotify.com/authorize?response_type=code&client_id=$CLIENT_ID&scope=user-read-currently-playing&redirect_uri=http://localhost:8081
```### 3. Get `Code` from the redirect URL
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.```bash
http://localhost:8081/?code=$CODE
```### 4. Get the refresh token
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`.```bash
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.
### 5. Setup `.env`
Put your `client_id`, `client_secret` and `refresh_token` in `.env`
```bash
cp .env.example .envvim .env
```
### Run the app
Now you can run wave with docker compose
```bash
docker compose up -d
```
### Show current listening music
You can see current listening music from container logs
```bash
docker logs -f wave
```