Prompt
Instructions: You post product tips to TikTok. For the clip and transcript in the input, upload the clip, write a caption with a hook under 60 characters and 4 hashtags, and create the TikTok draft. Return the draft id. How to do it
- Connect TikTok and mint a key In https://app.socialhandoff.com, open Connections, connect TikTok, then open TikTok settings on the account and choose visibility, comment/duet/stitch, and commercial disclosure. Then create an agent key named OpenAI Agents SDK scoped to TikTok with draft and schedule permission.
- Load the tools Connect with MCPServerStreamableHttp inside an async with block, pointing at https://app.socialhandoff.com/mcp and sending the key as a bearer header. The agent gets attach_media, draft_post, schedule_post, and preview_posts.
- Attach media The agent calls attach_media through the MCP adapter with a public url (or base64 data up to 8 MB) and alt text for the video or up to 35 photos. From plain code, POST https://app.socialhandoff.com/v1/media/import does the same. Pass the ids to draft_post in mediaIds.
- Run the agent Run the agent with Runner.run, passing the clip path and transcript. Check the returned draft id in the inbox.
Example draft
You have been exporting your reports the slow way. Press E on any chart to export it as CSV, or Shift+E for the whole dashboard. #producttips #analytics #worksmarter #shortcuts [Video: 20-second vertical screen recording passed in by the pipeline]
Gotchas
- Until TikTok audits your developer app, every post is private (visible only to the account), the posting account must be private, and only 5 accounts can post per day.
- The SDK caches nothing about approvals. If a run retries, send the same idempotencyKey so you get the same draft back.
- Visibility has no default. Posts are refused until the owner picks it in TikTok settings under Connections, along with comment, duet, and stitch.
- Media: Every post needs one video or up to 35 photos. Text-only posts are not possible.
- Video upload: Videos upload in chunks of 5 to 64 MB; smaller files go in one piece. Maximum duration depends on the creator account.
- Photo posts: Up to 35 JPEG or WebP images, a title up to 90 characters, and a description up to 4,000 characters.
- Required choices: TikTok requires a visibility setting with no default, comment/duet/stitch toggles, and a commercial content disclosure.
Frequently asked questions
Where do I choose who can see the video?
In Connections, TikTok settings reads the creator's live options and asks for visibility, comment, duet, stitch, and commercial content disclosure. Those choices apply to every post from that account.
Do I need the hosted MCP tool?
No. MCPServerStreamableHttp connects from your own process, so the key stays in your environment.
What does the reviewer see before approving?
The approval screen shows the caption, the media, the account's chosen settings, and TikTok's consent text, so the person approving knows exactly what will be posted.