Building Bluesky bots with GitHub Actions

Phil Nash - May 23 '23 - - Dev Community

What I built

A template repository that gives you a basis for building bots that post on a schedule to Bluesky.

Category Submission: Wacky Wildcards

App Link

The template bot lives here: https://github.com/philnash/bsky-bot/

The sourc code of my first bot using the template is here: https://github.com/philnash/phils-bsky-bots and if you have a Bluesky account, you can see the bot's account here.

Screenshots

Here's my bot in action. It posts a new dad joke once an hour and look, it's already got 10 followers! I should probably repost a few of its jokes so other people get to see it. It uses the Dad Jokes API to generate random jokes to share.

A screenshot of the Dad Jokes Bluesky bot. There are 3 posts visible, all jokes.

Description

I wanted to make it easy to create fun bots that use APIs or other data to post to Bluesky. This was an opportunity for me to learn how to schedule things with GitHub Actions and use the Bluesky API. I wrote up a full description of how to build with Bluesky and GitHub Actions here

Link to Source Code

Template: https://github.com/philnash/bsky-bot/

Template in use: https://github.com/philnash/phils-bsky-bots

Permissive License

MIT

Background

I love fun bots and I remember when it was easy to build them on Twitter using the API. Bluesky seems to be bringing back that access to a social platform that helped Twitter in its early days. Since this is built into Bluesky's AT Protocol it's not something that can just be removed, in fact it's fundamental to the platform itself. So, this was an attempt to make it easy for me, and with a template repo others, to build fun bots.

How I built it

I shared how I built it in a post on DEV here. Part of this was to learn the Bluesky API, but I also learned about scheduling GitHub Actions and using the workflow_dispatch hook to manually test and run Actions.

Next up for the template is to add sharing media so that bots can post images too.

Additional Resources/Info

Check out the full blog post on how to build your own Bluesky bot and power it with GitHub Actions on my site or here on DEV.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .