8000 [Notifier] BlueSky should return the uri instead of the cid · Issue #59739 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Notifier] BlueSky should return the uri instead of the cid #59739

New issue

10000 Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
javiereguiluz opened this issue Feb 10, 2025 · 2 comments
Closed

[Notifier] BlueSky should return the uri instead of the cid #59739

javiereguiluz opened this issue Feb 10, 2025 · 2 comments

Comments

@javiereguiluz
Copy link
Member
javiereguiluz commented Feb 10, 2025

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

@alexandre-daubois
Copy link
Member
alexandre-daubois commented Feb 10, 2025

Should this be something to merge in 7.1? I mean this looks like something that could potentially break applications that already rely on this behavior. Maybe uri could be added to info of SentMessage in 7.3 making it fetchable with $message->getInfo('url').

Otherwise, this could be considered a minor BC break for 7.3. uri would become the message ID, and cid would be added to message's info to still provide the data if someone relies on it.

@fabpot
Copy link
Member
fabpot commented Feb 10, 2025

Should this be something to merge in 7.1? I mean this looks like something that could potentially break applications that already rely on this behavior. Maybe uri could be added to info of SentMessage in 7.3 making it fetchable with $message->getInfo('url').

I think this should be considered as a bug.

nicolas-grekas added a commit that referenced this issue Feb 11, 2025
…age ID (javiereguiluz)

This PR was squashed before being merged into the 7.2 branch.

Discussion
----------

[Notifier] [BlueSky] Change the value returned as the message ID

| Q             | A
| ------------- | ---
| Branch?       | 7.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | #59739
| License       | MIT

Some BlueSky API actions require both the `cid` and the `uri` (see https://docs.bsky.app/docs/tutorials/like-repost) so we might re-add the `cid` to SentMessage's `info` in Symfony 7.3.

Commits
-------

4121f68 [Notifier] [BlueSky] Change the value returned as the message ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0