Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

feat: update Bluesky to use public AppView and remove Mastodon access token from public status requests

Paulo Castellano5658ea8c8c4e
diff --git a/app/Services/Social/BlueskyAnalytics.php b/app/Services/Social/BlueskyAnalytics.php
index cdb309ff1..70eb29605 100644
--- a/app/Services/Social/BlueskyAnalytics.php
+++ b/app/Services/Social/BlueskyAnalytics.php
@@ -20,13 +20,16 @@ class BlueskyAnalytics
return ['unsupported' => true, 'reason' => 'missing_post_id'];
}
- $service = data_get($account->meta, 'service', 'https://bsky.social');
$did = $account->platform_user_id;
$atUri = "at://{$did}/app.bsky.feed.post/{$postPlatform->platform_post_id}";
- // Public AppView API: no auth required for reading post counts.
+ // Read counts (likes, reposts, replies, quotes) live on the AT
+ // Protocol AppView, not the PDS. The user's PDS requires Bearer auth
+ // for this endpoint; the public AppView does not.
+ $appView = (string) config('trypost.platforms.bluesky.public_appview');
+
$response = $this->socialHttp()
- ->get("{$service}/xrpc/app.bsky.feed.getPosts", [
+ ->get("{$appView}/xrpc/app.bsky.feed.getPosts", [
'uris' => [$atUri],
]);
diff --git a/app/Services/Social/MastodonAnalytics.php b/app/Services/Social/MastodonAnalytics.php
index 3b1769139..a7348f1c0 100644
--- a/app/Services/Social/MastodonAnalytics.php
+++ b/app/Services/Social/MastodonAnalytics.php
@@ -22,8 +22,10 @@ class MastodonAnalytics
$instance = data_get($account->meta, 'instance', 'https://mastodon.social');
+ // Public posts: no auth needed. Our token only requests write scopes
+ // (read:accounts + write:statuses + write:media), so attaching the
+ // Bearer would 403 with "outside the authorized scopes".
$response = $this->socialHttp()
- ->withToken($account->access_token)
->get("{$instance}/api/v1/statuses/{$postPlatform->platform_post_id}");
if ($response->failed()) {
diff --git a/config/trypost.php b/config/trypost.php
index df4ff9e24..c0606acd8 100644
--- a/config/trypost.php
+++ b/config/trypost.php
@@ -87,6 +87,7 @@ return [
],
'bluesky' => [
'enabled' => env('BLUESKY_ENABLED', true),
+ 'public_appview' => env('BLUESKY_PUBLIC_APPVIEW', 'https://public.api.bsky.app'),
],
'mastodon' => [
'enabled' => env('MASTODON_ENABLED', true),