this string has no description
0
teal.fm → Bluesky Bio Updater#
A Cloudflare Worker that automatically updates your Bluesky bio with your currently playing track from teal.fm, and removes it when the status expires.
How it works#
On a schedule (every 1 minutes by default), the Worker:
- Fetches your
fm.teal.alpha.actor.statusrecord from your PDS - If a track is active and not expired, appends a "Currently listening to:
{track}by{artist}" line to your bio - If nothing is playing (or the status has expired), removes the line cleanly
- Skips the Bluesky API call entirely if the bio hasn't changed
Session tokens and the last injected bio line are cached in KV to minimise unnecessary API calls.
Prerequisites#
- A Cloudflare account
- A teal.fm account with an active PDS status record
- A Bluesky account with an app password
Setup#
1. Create a KV namespace#
- Go to Workers & Pages → KV in the Cloudflare dashboard
- Click Create a namespace, name it
TEALFM_BIO_KV, and save
2. Create the Worker#
- Go to Workers & Pages → Create
- Choose Create Worker, give it a name, and click Deploy
- Click Edit Code and paste in the contents of
src/index.js - Before saving, update the two constants at the top of the file to point to your own PDS and DID:
const STATUS_URL =
"https://your-pds.example.com/xrpc/com.atproto.repo.getRecord" +
"?repo=did:plc:yourdidhere" +
"&collection=fm.teal.alpha.actor.status" +
"&rkey=self";
const BSKY_PDS = "https://your-pds.example.com";
- Click Deploy
3. Bind the KV namespace#
- In your Worker, go to Settings → Bindings
- Click Add, choose KV Namespace
- Set the variable name to
TEALFM_BIO_KVand select the namespace you created in step 1 - Click Save
4. Add secrets#
- In your Worker, go to Settings → Environment Variables
- Add the following as secrets (click Encrypt):
| Variable name | Value |
|---|---|
BSKY_IDENTIFIER |
Your Bluesky handle or DID |
BSKY_PASSWORD |
Your Bluesky app password |
- Click Save
5. Set the cron trigger#
- In your Worker, go to Settings → Triggers
- Under Cron Triggers, click Add Cron Trigger
- Enter
*/1 * * * *to run every 1 minutes - Click Save
Manual trigger#
You can trigger a run at any time by visiting your Worker's /run endpoint in a browser:
https://your-worker.your-subdomain.workers.dev/run
KV storage#
The Worker uses two KV keys:
| Key | Purpose |
|---|---|
bsky_session |
Cached Bluesky session token (TTL: 90 min) |
bio_last_np_line |
The exact now-playing line last injected into your bio (TTL: 1 hr) |
The bio_last_np_line key lets the Worker reliably strip the previous line even if you manually edit your bio between runs.
Bio format#
When a track is playing, the following line is appended to your existing bio, separated by a blank line:
Currently listening to: Track Name by Artist Name
When nothing is playing, the line is removed and your original bio is restored exactly.
Configuration reference#
| Constant | Default | Description |
|---|---|---|
NOW_PLAYING_PREFIX |
"Currently listening to: " |
Prefix used to identify and strip the injected line |
KV_SESSION_KEY |
"bsky_session" |
KV key for the cached session |
KV_LAST_LINE_KEY |
"bio_last_np_line" |
KV key for the last injected line |
| Cron schedule | */2 * * * * |
How often the Worker runs (set under Settings → Triggers) |