Description
Symfony version(s) affected
7.1.0
Description
When you post a message successfully on BlueSky, the response is a JSON structure like:
{
"uri": "at://did:plc:u5cwb2mwiv2bfq53cjufe6yn/app.bsky.feed.post/3k4duaz5vfs2b",
"cid": "bafyreibjifzpqj6o6wcq3hejh7y4z4z2vmiklkvykc57tw3pcbx3kxifpm"
}
See https://docs.bsky.app/docs/advanced-guides/posts#post-record-structure
The SentMessage
created by the BlueSky notifier includes the cid
as the "message ID". However, it'd be better to return the uri
.
This is because you can't build the public URL of the post with the cid
. In the URI, the did:plc:u5cwb2mwiv2bfq53cjufe6yn
part is the $handle
(unless you have a custom handle) and the 3k4duaz5vfs2b
is the real $postId
. So, the public URL is built as follows:
$publicUrl = "https://bsky.app/profile/{$handle}/post/{$postId}";
Thanks!
How to reproduce
On symfony.com we use something like this to store the $postId
from BlueSky:
$postId = $this->socialNetworkNotifier->postMessage(SocialNetwork::BlueSky, '... the message ...');
Later, we use that ID to build the URL and publish it as a link on Slack. This is generating wrong URLs and show 404 errors.
Possible Solution
Return the uri
instead of the cid
as the message ID.
Additional Context
No response