AD
Launch on Firsto—Launch your project today — get a DR57 backlink instantly.
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
12forks
5contributors
1open issues

Dates

Created:March 20, 2024
Last updated:August 22, 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.

1221•Go
vvakameatproto-vvvot

@vvvot.bsky.social bot implementation

4•Go
mattnbsky

A cli application for bluesky social

419•Go
jazwareatproto.tools

A looking glass for the AT Proto Firehose

23•Go
whtwndwhitewind-blog

The AT Protocol blogging platform

156•Go
bluesky-socialjetstream

A simplified JSON event stream for AT Proto

426•Go

Resources

GitHub Repository

License

Apache-2.0

Author

danrusei
danrusei

Activity

Last commit: August 22, 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 listFirstoCoast Fire CalculatorAsphalt CalculatorDog Names World

This website may contain affiliate links

© 2025 BskyInfo. All rights reserved.