-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
π Description
When users select the "UPLOAD" content posting method for TikTok photo posts, their title and description are lost even though the TikTok API supports these fields. The title and description are only preserved when using "DIRECT_POST" method, creating inconsistent user experience.
π Reproduction steps
- Go to create a new TikTok post with photo content
- Select "UPLOAD" as the content posting method
- Add a title (for photos) and description in the provided fields
- Publish the post
- Check the resulting TikTok post - title and description are missing
Alternative reproduction:
- Use "DIRECT_POST" method with same photo, title, and description
- Publish the post
- Title and description are properly included
π Expected behavior
Both "UPLOAD" and "DIRECT_POST" methods should preserve title and description for photo posts since both use the same TikTok API endpoint (/content/init/) which supports these fields according to the TikTok API documentation.
π Actual Behavior
- UPLOAD method: Title and description are stripped from the API request
- DIRECT_POST method: Title and description are included correctly
- Both methods use identical
/content/init/endpoint but only one includes the post metadata
π Additional context
Technical Details
- File affected:
libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts - Root cause: Conditional logic on lines 457-458 only includes
post_infowhencontent_posting_method === 'DIRECT_POST' - Both methods use same endpoint but have different metadata inclusion logic
Current problematic code
...((firstPost?.settings?.content_posting_method || 'DIRECT_POST') === 'DIRECT_POST'
? { post_info: { title, description, ... } }
: {})API endpoint usage
- UPLOAD photos:
/content/init/β supports title/description - DIRECT_POST photos:
/content/init/β supports title/description - Current code: Only includes post_info for DIRECT_POST β
User Impact
- Users who prefer UPLOAD method for draft/manual review lose their content metadata
- Inconsistent behavior between two posting methods for the same content type
- Users must manually re-add titles/descriptions in TikTok app after upload
API Reference
According to TikTok API documentation, the /content/init/ endpoint supports:
title: string (optional, max 90 UTF-16 runes)description: string (optional, max 4000 UTF-16 runes)- Both
post_mode: "DIRECT_POST"andpost_mode: "MEDIA_UPLOAD"(UPLOAD)
Proposed Solution
Update the conditional logic to include post_info for all photo posts regardless of posting method:
// Include post_info for photos regardless of posting method
...(isPhoto ? {
post_info: this.createPostInfo(postDetails, true)
} : ((firstPost?.settings?.content_posting_method || 'DIRECT_POST') === 'DIRECT_POST' ? {
post_info: this.createPostInfo(postDetails, false)
} : {})),This ensures consistent behavior between UPLOAD and DIRECT_POST methods for photo posts while preserving existing video posting behavior.
β I checked and didn't find similar issue
π§ Are you willing to submit PR?
Yes I am willing to submit a PR!