A Bluesky integration that:
- Updates your profile description with your currently playing track from Last.fm or ListenBrainz
- Posts your weekly top 5 artists every Friday at 15:00 UTC (Last.fm only)
This application requires a Bluesky account and at least one scrobble service API key. You can use the free tier of Cloudflare for this application.
Updates your Bluesky profile description with your currently playing track. This runs every minute and will update your profile if you're currently scrobbling a track.
- Supports both Last.fm and ListenBrainz
- When both services are configured, uses the most recently scrobbled track
- Updates every minute
- Only updates when there's a new track playing
Every Friday at 15:00 UTC, posts an image to your Bluesky feed showing your top 5 most played artists from the past week.
- Currently supports Last.fm only
- Posts automatically every Friday at 15:00 UTC
- Generates a custom image with your top 5 artists of the last week.
- Includes play counts for each artist
This is a Cloudflare worker, so you'll need an account.
- Sign up at Cloudflare
- Install Wrangler:
npm install -g wrangler
- Run
wrangler login
- Log into Bluesky
- Go to Settings → App Passwords
- Create a new app password. You can use your real password, but it's recommended to create a new one for this app that can be revoked if necessary. This also allows you to login even if you have MFA enabled.
You need to set up at least one of these services:
- Create an account at Last.fm
- Get API credentials from Last.fm API
- Create an account at ListenBrainz
- Get your API token from Profile Settings
Note: The weekly top 5 artists feature currently only works with Last.fm. If both services are configured for profile updates, Scrobble Blue will automatically use the most recently scrobbled track from either service.
-
Clone the repository:
git clone git@github.com:willmanduffy/scrobble-blue.git cd scrobble-blue
-
Install dependencies:
npm install
-
Create a KV namespace:
- Go to your Cloudflare Dashboard
- Navigate to Workers & Pages → KV
- Click "Create a namespace"
- Name it
BLUESKY_SESSION_STORAGE
- Copy the ID of the newly created namespace
-
Configure environment variables:
cp .dev.vars.example .dev.vars cp wrangler.toml.example wrangler.toml
Fill out
.dev.vars
with your credentials and replace the KV_ID inwrangler.toml
with your copied KV namespace ID. It should look like this:kv_namespaces = [ { binding = "BLUESKY_SESSION_STORAGE", id = "your-kv-namespace-id" } ]
-
Deploy secrets to Cloudflare:
wrangler secret put BSKY_USERNAME wrangler secret put BSKY_PASSWORD # For Last.fm wrangler secret put LASTFM_API_KEY wrangler secret put LASTFM_SECRET wrangler secret put LASTFM_USERNAME # For ListenBrainz wrangler secret put LISTENBRAINZ_TOKEN wrangler secret put LISTENBRAINZ_USERNAME
-
Deploy the worker:
wrangler deploy
Run locally:
wrangler dev --test-scheduled
To test the different scheduled tasks locally:
# Test currently playing track sync
curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"
# Test weekly top artists post (Last.fm only)
curl "http://localhost:8787/__scheduled?cron=0+15+*+*+6"
To run tests:
npx vitest