Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(tiktok): resolve the public post id for FILE_UPLOAD publish ids in post analytics

Gilad Resisida7f7a18787d
diff --git a/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts b/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts
index 01ac1c0dd..b33744a5c 100644
--- a/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts
@@ -1141,7 +1141,10 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
): Promise<AnalyticsData[]> {
const today = dayjs().format('YYYY-MM-DD');
- if (postId.indexOf('v_pub_url') > -1) {
+ // Posts whose public id was not available yet when publishing keep the
+ // publish_id (v_pub_url~... / v_pub_file~...) as releaseId - resolve it
+ // to the public post id first.
+ if (postId.indexOf('_pub_') > -1) {
const post = await (
await fetch(
'https://open.tiktokapis.com/v2/post/publish/status/fetch/',