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.

fix: use publicaly_available_post_id from TikTok status to build video URL

Paulo Castellanoc5c36a8aba6c
diff --git a/app/Services/Social/TikTokPublisher.php b/app/Services/Social/TikTokPublisher.php
index 4cc72f9f7..0f7ec7306 100644
--- a/app/Services/Social/TikTokPublisher.php
+++ b/app/Services/Social/TikTokPublisher.php
@@ -154,11 +154,12 @@ class TikTokPublisher
}
// Wait for processing and get final status
- $this->waitForPublishStatus($publishId);
+ $statusData = $this->waitForPublishStatus($publishId);
+ $postId = data_get($statusData, 'publicaly_available_post_id.0');
return [
- 'id' => $publishId,
- 'url' => $this->buildTikTokUrl($postPlatform->socialAccount),
+ 'id' => $postId ?? $publishId,
+ 'url' => $this->buildTikTokUrl($postPlatform->socialAccount, $postId),
];
}
@@ -215,11 +216,12 @@ class TikTokPublisher
}
// Wait for processing and get final status
- $this->waitForPublishStatus($publishId);
+ $statusData = $this->waitForPublishStatus($publishId);
+ $postId = data_get($statusData, 'publicaly_available_post_id.0');
return [
- 'id' => $publishId,
- 'url' => $this->buildTikTokUrl($postPlatform->socialAccount),
+ 'id' => $postId ?? $publishId,
+ 'url' => $this->buildTikTokUrl($postPlatform->socialAccount, $postId),
];
}
@@ -262,10 +264,14 @@ class TikTokPublisher
return ['publish_id' => $publishId];
}
- private function buildTikTokUrl(SocialAccount $account): ?string
+ private function buildTikTokUrl(SocialAccount $account, ?string $postId = null): ?string
{
$username = $account->username;
+ if ($username && $postId) {
+ return "https://www.tiktok.com/@{$username}/video/{$postId}";
+ }
+
if ($username) {
return "https://www.tiktok.com/@{$username}";
}