atproto libraries implementation in ocaml

bsky_bot#

Bluesky bot for posting, viewing timelines, fetching profiles, and following users via AT Protocol.

Usage#

bsky_bot --user <HANDLE> --password <APP_PASSWORD> [COMMAND]

Authentication is required for all operations. Use an App Password from your Bluesky account settings.

Options#

Option Description
--pds <URL> PDS URL (default: https://bsky.social)
-u, --user <STRING> Handle or email for login
-p, --password <STRING> App password
--post <TEXT> Create a post with the given text
-t, --timeline Show timeline
--limit <INT> Number of timeline posts (default: 10)
--profile <ACTOR> Get profile for handle or DID
--follow <DID> Follow a user by DID
-h, --help Show help message

Examples#

Post a message:

dune exec examples/bsky_bot/bsky_bot.exe -- \
  --user myhandle.bsky.social \
  --password xxxx-xxxx-xxxx-xxxx \
  --post "Hello from OCaml!"

View your timeline:

dune exec examples/bsky_bot/bsky_bot.exe -- \
  --user myhandle.bsky.social \
  --password xxxx-xxxx-xxxx-xxxx \
  --timeline --limit 5

Get a user's profile:

dune exec examples/bsky_bot/bsky_bot.exe -- \
  --user myhandle.bsky.social \
  --password xxxx-xxxx-xxxx-xxxx \
  --profile jay.bsky.social

Follow a user:

dune exec examples/bsky_bot/bsky_bot.exe -- \
  --user myhandle.bsky.social \
  --password xxxx-xxxx-xxxx-xxxx \
  --follow did:plc:z72i7hdynmk6r22z27h6tvur

Output#

Timeline output:

Logged in as myhandle.bsky.social
@jay.bsky.social: Just shipped a new feature...
@alice.bsky.social: Check out this thread about...

Profile output:

Handle:    @jay.bsky.social
DID:       did:plc:z72i7hdynmk6r22z27h6tvur
Name:      Jay
Bio:       Building things
Followers: 12345
Following: 678
Posts:     901

Notes#

  • Posts automatically detect and link mentions (@handle.domain) and URLs
  • The --post option supports text up to 300 graphemes (Bluesky limit)
  • Use App Passwords from Settings > App Passwords, not your main password