AD
Boost Your Brand on BlueSky—Exclusive banner space to amplify your reach within the BlueSky community.
BSkyInfo LogoBskyInfo
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryArticlesGuidesGlossaryBluesky SDKsSponsor
Submit
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryGuidesGlossaryArticlesBluesky SDKsSponsorSubmit
  1. SDKs
  2. /Go
  3. /gobot-bsky
danrusei

gobot-bsky

A Go SDK for Bluesky and AT Protocol by danrusei

Bluesky Bot library in Go

GitHub Stats

18stars
8forks
3contributors
0open issues

Dates

Created:March 20, 2024
Last updated:May 12, 2025

README

The following content is from gobot-bsky's GitHub repository. All rights reserved by the original author.

gobot-bsky

Gobot-bsky - a simple GO lib to write Bluesky bots

Usage example

Has to provide:

  • a handle - example bluesky handle: "example.bsky.social"
  • an apikey - is used for authetication and the retrieval of the access token and refresh token. To create a new one: Settings --> App Passwords
  • the server (PDS) - the Bluesky's "PDS Service" is bsky.social.
import 	gobot "github.com/danrusei/gobot-bsky"

func main() {

	godotenv.Load()
	handle := os.Getenv("HANDLE")
	apikey := os.Getenv("APIKEY")
	server := "https://bsky.social"

	ctx := context.Background()

	agent := gobot.NewAgent(ctx, server, handle, apikey)
	agent.Connect(ctx)

	// Facets Section
	// =======================================
	// Facet_type coulf be Facet_Link, Facet_Mention or Facet_Tag
	// based on the selected type it expect the second argument to be URI, DID, or TAG
	// the last function argument is the text, part of the original text that is modifiend in Richtext

	post1, err := gobot.NewPostBuilder("Hello to Bluesky, the coolest open social network").
		WithFacet(gobot.Facet_Link, "https://docs.bsky.app/", "Bluesky").
		WithFacet(gobot.Facet_Tag, "bsky", "open social").
		Build()
	if err != nil {
		fmt.Printf("Got error: %v", err)
	}

	cid1, uri1, err := agent.PostToFeed(ctx, post1)
	if err != nil {
		fmt.Printf("Got error: %v", err)
	} else {
		fmt.Printf("Succes: Cid = %v , Uri = %v", cid1, uri1)
	}

	// Embed Links section
	// =======================================

	u, err := url.Parse("https://go.dev/")
	if err != nil {
		log.Fatalf("Parse error, %v", err)
	}

	previewUrl, err := url.Parse("https://www.freecodecamp.org/news/content/images/2021/10/golang.png")
	if err != nil {
		log.Fatalf("Parse error, %v", err)
	}
	previewImage := gobot.Image{
		Title: "Golang",
		Uri:   *previewUrl,
	}
	previewImageBlob, err := agent.UploadImage(ctx, previewImage)
	if err != nil {
		log.Fatalf("Parse error, %v", err)
	}

	post2, err := gobot.NewPostBuilder("Hello to Go on Bluesky").
		WithExternalLink("Go Programming Language", *u, "Build simple, secure, scalable systems with Go", *previewImageBlob).
		Build()
	if err != nil {
		fmt.Printf("Got error: %v", err)
	}

	cid2, uri2, err := agent.PostToFeed(ctx, post2)
	if err != nil {
		fmt.Printf("Got error: %v", err)
	} else {
		fmt.Printf("Succes: Cid = %v , Uri = %v", cid2, uri2)
	}

	// Embed Images section
	// =======================================
	images := []gobot.Image{}

	url1, err := url.Parse("https://www.freecodecamp.org/news/content/images/2021/10/golang.png")
	if err != nil {
		log.Fatalf("Parse error, %v", err)
	}
	images = append(images, gobot.Image{
		Title: "Golang",
		Uri:   *url1,
	})

	blobs, err := agent.UploadImages(ctx, images...)
	if err != nil {
		log.Fatalf("Parse error, %v", err)
	}

	post3, err := gobot.NewPostBuilder("Gobot-bsky - a simple golang lib to write Bluesky bots").
		WithImages(blobs, images).
		Build()
	if err != nil {
		fmt.Printf("Got error: %v", err)
	}

	cid3, uri3, err := agent.PostToFeed(ctx, post3)
	if err != nil {
		fmt.Printf("Got error: %v", err)
	} else {
		fmt.Printf("Succes: Cid = %v , Uri = %v", cid3, uri3)
	}

}

The results of running the above code

Content generated with gobot-bsky

You can now embed a preview image to the website url Content generated with gobot-bsky

Related SDKs

bluesky-socialindigo

Go source code for Bluesky's atproto services.

1123•Go
bluesky-socialjetstream

A simplified JSON event stream for AT Proto

385•Go
uabluerailindexer

ATproto PDS indexer

21•Go
CharlesDardamanblueskyfirehose

Simple golang firehose for Bluesky.

62•Go
ericvolp12go-bsky-feed-generator

A minimal implementation of a BlueSky Feed Generator in Go

32•Go
ericvolp12bsky-experiments

A handful of Go-based tools for poking around with BlueSky using the AT Protocol

275•Go

Resources

GitHub Repository

License

Apache-2.0

Author

danrusei
danrusei

Activity

Last commit: May 12, 2025
Commit frequency: Unknown

Our Sponsors

Your Brand Here!

50K+ engaged viewers every month

Limited spots available!

📧 Contact us via email🦋 Contact us on Bluesky
BSkyInfo LogoBskyInfo

The Most Comprehensive Bluesky Tools Directory

Stay updated with the latest Bluesky tools and ecosystem news 🦋

Bluesky butterfly logo
Quick LinksSubmit a ToolSponsorAboutLegal Information
ToolsFeed DirectoryLabeler DirectorySchedulingAnalyticsAll ToolsCategoriesCollectionsTags
ResourcesArticlesBluesky GuidesBluesky GlossaryBluesky SDKsBluesky ResourcesSkyRaffleMeida Coverage
Our ProductsRaffleBlueAiTeach ToolsLaiewAI affiliate listFirsto

This website may contain affiliate links

© 2025 BskyInfo. All rights reserved.