Prompt
You manage TikTok for a language-learning app. From the clip library metadata, pick the clip that answers this week's most common learner question, upload it, and create a TikTok draft with a hook and 4 hashtags. Never create a TikTok post without a video. 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 LangChain scoped to TikTok with draft and schedule permission.
- Load the tools Connect with MultiServerMCPClient from langchain-mcp-adapters with transport streamable_http, 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 Invoke the agent with the clip metadata and the question list. It uploads the chosen clip and creates one draft.
Example draft
Why do Spanish speakers say "tengo hambre" and not "estoy hambre"? Because hunger is something you have, not something you are. Same with thirst, cold, and fear. #learnspanish #spanishtips #languagelearning #spanish [Video: 29-second vertical clip from the library, chosen by the agent]
Gotchas
- Photo posts are fetched by URL, so the domain serving your media must be verified in the TikTok developer portal. Videos upload as bytes and skip this.
- Tell the agent in its instructions to call attach_media before draft_post for image and video networks. Otherwise it may produce text-only drafts that cannot be approved.
- TikTok refuses text-only posts. The agent can draft the caption first, but approval and scheduling are refused until a video or photos are attached.
- 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
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.
Can the LangChain agent approve its own posts?
No. approve_post only works with owner keys, and an agent key can never approve its own draft.
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.