From 4c04b37e4f8d63675faa72d152985f0261aae066 Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Wed, 29 Jul 2026 00:03:14 +0200 Subject: [PATCH] feat(social): send TikTok uploads to drafts instead of publishing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upload-Post's `post_mode` defaults to DIRECT_POST, so a clip went straight to the user's TikTok feed. MEDIA_UPLOAD lands it in their drafts to finish in TikTok's own editor instead. Drafts are the right default for an automated pipeline: nothing reaches an audience without the account owner seeing it, and covers, sounds and trending hashtags are chosen inside TikTok anyway — the parts that decide whether a clip travels are exactly the parts this cannot do from the outside. Applied to both paths that can target TikTok (the clip publisher and the SaaS-shorts publisher) through one constant, so they cannot drift apart. TIKTOK_POST_MODE=DIRECT_POST restores publishing without a code change. The UI now says so before the button is pressed, in both publishers, and leads with the upside rather than the caveat. Without it the change reads as a bug: someone expecting a live post, finding nothing on their profile, and concluding the upload failed. The notice also tells them a TikTok notification is coming, which the Upload-Post docs confirm for MEDIA_UPLOAD ("users will receive an inbox notification"), so they know where to look. --- app.py | 12 ++++++++++++ dashboard/src/components/ResultCard.jsx | 16 ++++++++++++++++ dashboard/src/components/SaaShortsTab.jsx | 10 ++++++++++ 3 files changed, 38 insertions(+) diff --git a/app.py b/app.py index 07fb810..2796671 100644 --- a/app.py +++ b/app.py @@ -36,6 +36,16 @@ os.makedirs(OUTPUT_DIR, exist_ok=True) # Default to 1 if not set, but user can set higher for powerful servers MAX_CONCURRENT_JOBS = int(os.environ.get("MAX_CONCURRENT_JOBS", "5")) MAX_FILE_SIZE_MB = 2048 # 2GB limit + +# How TikTok receives our uploads. MEDIA_UPLOAD lands the video in the user's +# TikTok drafts so they finish the post inside TikTok's own editor; DIRECT_POST +# publishes straight to their feed, which is Upload-Post's default. +# +# Drafts are the safer default for an automated pipeline: nothing reaches an +# audience without the account owner seeing it first, and TikTok's own editor is +# where covers, sounds and hashtags actually get chosen. The UI must say so — +# a user who expects a published post and finds a draft will read it as a bug. +TIKTOK_POST_MODE = os.environ.get("TIKTOK_POST_MODE", "MEDIA_UPLOAD").strip() JOB_RETENTION_SECONDS = int(os.environ.get("JOB_RETENTION_SECONDS", "3600")) # job/file retention (issue #46) # Ceiling for the working directory once it lives on a persistent volume: the # age-based sweep alone can't stop a burst of long videos from filling the disk. @@ -2552,6 +2562,7 @@ async def post_to_socials(req: SocialPostRequest, request: Request): # Add Platform specifics if "tiktok" in req.platforms: data_payload["tiktok_title"] = final_description + data_payload["post_mode"] = TIKTOK_POST_MODE if "instagram" in req.platforms: data_payload["instagram_title"] = final_description @@ -3425,6 +3436,7 @@ async def saasshorts_post_to_socials(req: SaaSPostRequest, request: Request): if "tiktok" in req.platforms: data_payload["tiktok_title"] = final_description + data_payload["post_mode"] = TIKTOK_POST_MODE if "instagram" in req.platforms: data_payload["instagram_title"] = final_description data_payload["media_type"] = "REELS" diff --git a/dashboard/src/components/ResultCard.jsx b/dashboard/src/components/ResultCard.jsx index cfea6b4..4551c53 100644 --- a/dashboard/src/components/ResultCard.jsx +++ b/dashboard/src/components/ResultCard.jsx @@ -849,6 +849,22 @@ export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostK )} + {/* TikTok is sent as a draft, so say so before they press publish: + someone expecting a live post and finding nothing on their + profile will read it as a failure. Lead with the upside — + posting from inside the app is what the algorithm rewards. */} + {platforms.tiktok && ( +
+ +
+ tiktok arrives as a draft, not a live post — you'll + get a notification in the app. finishing it there lets you add trending + sounds, effects and hashtags, which reaches more people than posting + straight from an api. +
+
+ )} +
{/* Title & Description */}
diff --git a/dashboard/src/components/SaaShortsTab.jsx b/dashboard/src/components/SaaShortsTab.jsx index 85c4db8..9026c09 100644 --- a/dashboard/src/components/SaaShortsTab.jsx +++ b/dashboard/src/components/SaaShortsTab.jsx @@ -1397,6 +1397,16 @@ export default function SaaShortsTab({ geminiApiKey, elevenLabsKey, falKey, uplo })} /> + {/* Same notice as ResultCard: TikTok lands as a draft, + and finding nothing live reads as a failed post. */} + {publishPlatforms.tiktok && ( +

+ tiktok arrives as a draft and you'll get a + notification in the app — finishing it there lets you add trending sounds + and hashtags, which reaches more people than posting from an api. +

+ )} + {/* Schedule toggle */}