Building Bluesky bots with GitHub Actions
Tags: githubhack23, github, opensource, showdev
Published: 2023-05-23 06:45:55

--- 
title: Building Bluesky bots with GitHub Actions
published: true 
description: My submission to the GitHub + DEV Hackathon 2023! 
tags: githubhack23, github, opensource, showdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvdv6rd473bn03chn1se.jpg
--- 

## What I built 

A template repository that gives you a basis for building bots that post on a schedule to [Bluesky](https://bsky.app/). 

### 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](https://staging.bsky.app/profile/dadjokes.skybot.club).

### 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](https://icanhazdadjoke.com/) to generate random jokes to share.

![A screenshot of the Dad Jokes Bluesky bot. There are 3 posts visible, all jokes. "What do you call an elephant that doesn’t matter? An irrelephant." "What do you call a gorilla wearing headphones? Anything you'd like, it can't hear you." "What did the ocean say to the shore? Nothing, it just waved."](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6e3v1q8pznxqqqvvchh.png)

### 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](https://github.com/bluesky-social/atproto/tree/main/packages/api). I wrote up a full description of [how to build with Bluesky and GitHub Actions here](https://dev.to/philnash/build-bots-on-bluesky-with-nodejs-and-github-actions-3c4l)

### 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](https://dev.to/philnash/build-bots-on-bluesky-with-nodejs-and-github-actions-3c4l). Part of this was to learn the Bluesky API, but I also learned about [scheduling GitHub Actions](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule) and using [the `workflow_dispatch` hook](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch) 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](https://philna.sh/blog/2023/05/01/build-bots-on-bluesky-with-typescript/) or [here on DEV](https://dev.to/philnash/build-bots-on-bluesky-with-nodejs-and-github-actions-3c4l).