Skip to Content
bsky

πŸ’œ Engagement

Like, repost and follow, and reverse each one.

Engagement functions take a post URL (a bsky.app link or at:// URI) or, for follows, a handle. All return Promise<void>.

import { like, repost, follow, unlike, unrepost, unfollow } from "@kud/bsky"

const post = "https://bsky.app/profile/alice.example.com/post/3kexample"

await like(post)
await repost(post)
await follow("alice.example.com")
FunctionArgumentDoes
like(url)postCreates an app.bsky.feed.like record
repost(url)postCreates an app.bsky.feed.repost record
follow(handle)handle or DIDCreates an app.bsky.graph.follow record
unlike(url)postDeletes your like
unrepost(url)postDeletes your repost
unfollow(handle)handle or DIDDeletes your follow

Undoing

The reversals look up the record you created before deleting it. If there is nothing to undo they throw rather than silently succeeding:

  • unlike: You haven't liked that post.
  • unrepost: You haven't reposted that post.
  • unfollow: You don't follow <handle>.

Liking or following something twice is not guarded by the library; the server decides what happens.

On this page