Skip to content

Automate posts to BlueSky with Cloudflare Workers, Cron Triggers, Workers KV, and the Blue Sky API

Notifications You must be signed in to change notification settings

elizabethsiegle/warriors-data-kv-bsky-bot

Repository files navigation

Automate Posts to BlueSky with BlueSky API, Cloudflare Workers, Cloudflare KV, Cron Triggers

This is a Cloudflare Workers application that makes use of Cron Triggers to automate posting once a day to Blue Sky. It passes data from basketball-data/GSW.json hosted in a Cloudflare KV namespace to a Workers AI call using Llama-3.2.

That data was scraped from https://www.basketball-reference.com/teams/${team}/${year}.html

Check it out on Blue Sky here!

Setup

Copy .dev.vars.example to .dev.vars and add your BLUESKY_USERNAME and BLUESKY_PASSWORD.

For more information about hosting data on Workers KV, see this Workers KV Getting Started page

npm install
npx wrangler login # if it's your first time here

In wrangler.toml, you can set the time to post in the crons array beneath the triggers configuration. Reminder--cron tabs are written in UTC. I used the Cloudflare Workers AI LLM Playground to generate my cron tabs using this system message from my wonderful teammate Craig Dennis:

You help write cron tabs.

The user will give you a description of time they are looking for and your job is to generate a cron tab string.

The user will specify timezones, you know the server runs in UTC.

Return the cron tab and the explanation.

Develop locally

npm run dev

Deploy

npm run deploy

Releases

No releases published

Packages

No packages published