Open scripting opened 1 year ago
Hi Dave, creating a reply post is just like creating a top-level post (same endpoint), except it also includes a "reply" property in the payload, alongside "text" and "createdAt".
The reply value is an object with a reference to the post that you are replying to, and that post's top-level ancestor root.
{
"text": "👋",
"createdAt": "2023-06-11T15:15:08.457Z",
"reply": {
"root": {
"uri": "at://did:plc:wwzossfdokoglb5zygqg7o6n/app.bsky.feed.post/3jxvjc2u2pr2h",
"cid": "bafyreidfhgx2odyjcyi6cl2iau64quaqwfyusc455szju32updymfswhny"
},
"parent": {
"uri": "at://did:plc:wwzossfdokoglb5zygqg7o6n/app.bsky.feed.post/3jxvjn3qh5w2r",
"cid": "bafyreiejfpil2o7vwsjc6sxkhpf63ya6p55uujjkdmtuowpk63hzrtukhe"
}
}
}
A strong reference to a thing in Bluesky consists of a uri
(id of the thing), and a cid
(the content version of the thing, e.g. for subsequent edits)
You can get the strong reference for any post in Bluesky using getRecord, which is a very easy endpoint to test over GET since it does not require auth. The rkey
param is the suffix of the post permalink in the Bluesky web site.
e.g to get the record reference for this post: https://bsky.social/xrpc/com.atproto.repo.getRecord?repo=scripting.com&collection=app.bsky.feed.post&rkey=3jxvgvjzi7r2w
If you are replying to a top-level post, the root
and parent
have the same values.
Hope that helps!
Thanks @johnspurlock -- this is great. perfect answer.
btw this is the code it's being added to, i just want to add an inReplyTo option for the post. the same way we had it in twitter api, and have it now for mastodon.
https://github.com/scripting/textcasting/blob/main/textcasting.js#L63
I also sent a pointer to this thread to manton reece.
Happy to report -- threading works per @johnspurlock's perfect instructions.
https://staging.bsky.app/profile/bingeworthy.bsky.social/post/3jxwal3kerm2l
I'm using the Bingeworthy account to test this stuff.
It's still working. 😀
https://staging.bsky.app/profile/bingeworthy.bsky.social/post/3jxy72dbzxy2r
I'm doing cleanup work, getting ready to write docs, and release to testers.
This is the first end-user useful app I've done for Bluesky. People liked it on Twitter. Hopefully more people will hear about it, percentage-wise, on Bluesky.
@johnspurlock -- another question --
I have code that creates a new post on Bluesky.
https://github.com/scripting/textcasting/blob/main/textcasting.js#L63
I want to adapt it to be able to post a reply to another post.
I'm looking at the docs --
https://atproto.com/lexicons/com-atproto-repo
Not seeing an obvious way to do it.
Help much appreciated..