Skip to main content

Liking and reposting

Liking and reposting posts are a core feature of Bluesky. The official atproto SDK has dedicated methods for these actions.

Liking a post

Liking a post requires the post's URI and its CID.

The URI indicates the repository DID, collection, and record key. The CID is the hash of the record itself.

agent.like
  const { uri } = await agent.like(uri, cid)
ParameterTypeDescriptionRequired
uristringThe URI of the postYes
cidstringThe CID of the postYes

Unliking a post

Unliking a post requires only the post's URI, which refers to its record. In the case of a Like, unliking the post means deleting the Like record.

agent.deleteLike
  await agent.deleteLike(uri)
ParameterTypeDescriptionRequired
uristringThe URI of the post to un-likeYes

Reposting a post

Reposting and un-reposting looks almost exactly the same as liking and unliking.

agent.repost
  const { uri } = await agent.repost(uri, cid)
ParameterTypeDescriptionRequired
uristringThe URI of the postYes
cidstringThe CID of the postYes

Un-reposting a post

Same as unlike, un-reposting a post requires only the post's URI, whose record we want to delete.

agent.deleteRepost
  await agent.deleteRepost(uri)
ParameterTypeDescriptionRequired
uristringThe URI of the post to un-repostYes

Quote reposting

info

For information on quote posts, see the Create a post tutorial.