Skip to content

Instantly share code, notes, and snippets.

@Bl3f
Created November 18, 2024 11:38
Show Gist options
  • Select an option

  • Save Bl3f/cf13971008784c34ad38dfe63f3d0edd to your computer and use it in GitHub Desktop.

Select an option

Save Bl3f/cf13971008784c34ad38dfe63f3d0edd to your computer and use it in GitHub Desktop.
Answer to a Bluesky root post
import requests
from atproto import models
def reply_to_a_post(repo, post_id, text):
url = f"https://bsky.social/xrpc/com.atproto.repo.getRecord?repo={repo}&collection=app.bsky.feed.post&rkey={post_id}"
response = requests.get(url).json()
cid = response["cid"]
uri = response["uri"]
ref = {
"uri": uri,
"cid": cid,
}
reply_to = models.AppBskyFeedPost.ReplyRef(parent=ref, root=ref)
client.send_post(
text=text,
reply_to=reply_to,
)
repo = "ssp.sh"
post_id = "3lb5rw66ylc2j"
text = 'Bonjour from Python SDK 😊'
reply_to_a_post(repo, post_id, text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment