ProtoRune. Bsky
(proto_rune v0.5.1)
Copy Markdown
High-level Bluesky API helpers.
Provides ergonomic wrappers around repository operations and XRPC calls for common Bluesky tasks.
Examples
# Post
{:ok, post} = Bsky.post(session, "Hello!")
# Like
{:ok, like} = Bsky.like(session, post_uri, post_cid)
# Follow
{:ok, follow} = Bsky.follow(session, "alice.bsky.social")
# Get profile
{:ok, profile} = Bsky.get_profile(session, "bob.bsky.social")
Summary
Functions
Blocks an actor.
Deletes a post by its AT-URI.
Follows an actor.
Gets a post thread with context.
Gets multiple posts by their AT-URIs.
Gets an actor's profile.
Gets multiple actor profiles.
Gets the authenticated user's timeline.
Gets the count of unread notifications.
Likes a post.
Lists notifications for the authenticated user.
Mutes an actor (client-side muting via XRPC).
Posts a text message to Bluesky.
Reposts a post.
Searches for actors (profiles) matching a query.
Searches for posts matching a query.
Unblocks an actor by deleting the block record.
Unfollows an actor by deleting the follow record.
Unlikes a post by deleting the like record.
Unmutes an actor.
Unrepost by deleting the repost record.
Updates the authenticated user's profile.
Marks notifications as seen up to a given timestamp.
Types
@type session() :: ProtoRune.Session.t()
Functions
Blocks an actor.
Examples
{:ok, block} = Bsky.block(session, "spammer.bsky.social")
{:ok, block} = Bsky.block(session, "did:plc:xyz123")
Deletes a post by its AT-URI.
Examples
:ok = Bsky.delete_post(session, post.uri)
Follows an actor.
Examples
{:ok, follow} = Bsky.follow(session, "alice.bsky.social")
{:ok, follow} = Bsky.follow(session, "did:plc:abc123")
Gets a post thread with context.
Options
:depth- How many levels of replies to fetch (default: 6):parent_height- How many levels of parent posts to fetch (default: 80)
Examples
{:ok, thread} = Bsky.get_post_thread(session, post_uri)
Gets multiple posts by their AT-URIs.
Examples
uris = ["at://did:plc:xyz/app.bsky.feed.post/123", "at://..."]
{:ok, posts} = Bsky.get_posts(session, uris)
Gets an actor's profile.
Examples
{:ok, profile} = Bsky.get_profile(session, "alice.bsky.social")
Gets multiple actor profiles.
Examples
{:ok, profiles} = Bsky.get_profiles(session, ["alice.bsky.social", "bob.bsky.social"])
Gets the authenticated user's timeline.
Options
:limit- Number of posts (default: 50, max: 100):cursor- Pagination cursor
Examples
{:ok, %{feed: posts, cursor: cursor}} = Bsky.get_timeline(session)
{:ok, %{feed: more}} = Bsky.get_timeline(session, cursor: cursor)
Gets the count of unread notifications.
Examples
{:ok, %{count: unread}} = Bsky.get_unread_count(session)
Likes a post.
Examples
{:ok, like} = Bsky.like(session, post.uri, post.cid)
Lists notifications for the authenticated user.
Options
:limit- Number of notifications (default: 50):cursor- Pagination cursor:seen_at- Only return notifications after this timestamp
Examples
{:ok, %{notifications: notifs, cursor: cursor}} = Bsky.list_notifications(session)
Mutes an actor (client-side muting via XRPC).
Examples
{:ok, _} = Bsky.mute(session, "noisy.bsky.social")
Posts a text message to Bluesky.
Supports both plain text strings and RichText structs with facets.
Options
:langs- List of language codes (default:["en"]):reply_to- AT-URI of post to reply to:created_at- Timestamp (default: now)
Examples
# Simple text post
{:ok, post} = Bsky.post(session, "Hello Bluesky!")
# Reply to a post
{:ok, reply} = Bsky.post(session, "Great point!",
reply_to: "at://did:plc:xyz/app.bsky.feed.post/3k..."
)
# Rich text with mentions and links
alias ProtoRune.RichText
{:ok, rt} =
RichText.new()
|> RichText.text("Hello ")
|> RichText.mention("alice.bsky.social")
|> RichText.text("!")
|> RichText.build()
{:ok, post} = Bsky.post(session, rt)
Reposts a post.
Examples
{:ok, repost} = Bsky.repost(session, post.uri, post.cid)
Searches for actors (profiles) matching a query.
Options
:limit- Number of actors (default: 25, max: 100):cursor- Pagination cursor
Examples
{:ok, %{actors: actors}} = Bsky.search_actors(session, "alice")
Searches for posts matching a query.
Options
:sort-:topor:latest:since- Only posts after thisDate:until- Only posts before thisDate:author- Restrict to posts by this actor (handle or DID):lang- Restrict to this language code:domain- Restrict to posts linking to this domain:url- Restrict to posts linking to this URL:mentions- Restrict to posts mentioning these actors:tag- Restrict to posts with these hashtags:limit- Number of posts (default: 25, max: 100):cursor- Pagination cursor
Examples
{:ok, %{posts: posts}} = Bsky.search_posts(session, "elixir lang")
{:ok, %{posts: latest}} = Bsky.search_posts(session, "elixir", sort: :latest)
Unblocks an actor by deleting the block record.
Examples
:ok = Bsky.unblock(session, block.uri)
Unfollows an actor by deleting the follow record.
Examples
:ok = Bsky.unfollow(session, follow.uri)
Unlikes a post by deleting the like record.
Examples
:ok = Bsky.unlike(session, like.uri)
Unmutes an actor.
Examples
{:ok, _} = Bsky.unmute(session, "noisy.bsky.social")
Unrepost by deleting the repost record.
Examples
:ok = Bsky.unrepost(session, repost.uri)
Updates the authenticated user's profile.
Fetches the current app.bsky.actor.profile record, merges the given
changes, and writes it back, so fields not mentioned are preserved.
Options
:display_name- New display name:description- New profile description (bio):avatar-{data, content_type}tuple with the raw image bytes and its MIME type. The data is uploaded as a blob and linked in the record.
Examples
{:ok, _} = Bsky.update_profile(session, display_name: "Alice")
{:ok, _} =
Bsky.update_profile(session,
display_name: "Alice",
description: "Posting about Elixir",
avatar: {File.read!("avatar.png"), "image/png"}
)
@spec update_seen(session(), DateTime.t()) :: {:ok, map()} | {:error, term()}
Marks notifications as seen up to a given timestamp.
Examples
:ok = Bsky.update_seen(session, DateTime.utc_now())