Cross-post a video
Upload the video once, write a caption for each platform, and pick the right format on each one.
Steps
- Get the video. The user gives a public link to an MP4 file. Call
upload_media_from_urlwith theurl. Videos import in the background: callget_mediawith the returnedmedia_iduntilmedia_statusis"ready". If it becomes"failed", tell the user theerror_messagein plain words. Never attach a video that isn't ready. For a video already in their library, find it withlist_mediaandtype: "video". - Check the rules. Call
get_platform_rulesand compare the video with each platform's limits for length, size and aspect ratio.get_mediashows the video's details. If the video breaks a platform's rule, leave that platform out and tell the user why. - Pick the accounts. Call
list_accounts. Use the accounts the user named, or every healthy account on a video platform. Skip any account that can't post and say why. - Write a caption for each platform. Put a general caption in
content, and set each platform's own inplatform_content:- TikTok:
{"tiktok": {"content": "..."}}. Short, hook first, hashtags at the end. - Instagram Reels:
{"instagram": {"content": "...", "contentType": "Reels"}}. Hashtags at the end. - YouTube Shorts:
{"youtube": {"content": "<description>", "contentType": "Short", "settings": {"title": "<title>"}}}. The title is up to 100 characters, and YouTube doesn't allow<or>. Put what the video is about in the first two lines of the description. For a normal YouTube video, use"contentType": "Video". - LinkedIn:
{"linkedin": {"content": "..."}}. A first line that earns the click, short paragraphs. - Facebook Reels:
{"facebook": {"content": "...", "contentType": "Reels"}}. Follow the user's voice guide if there is one (seebrand-voice). Don't invent facts about the video; ask the user what it shows if you don't know.
- TikTok:
- Show the drafts. Show, per platform: format, title (YouTube), caption and time. Ask the user to confirm.
- Create it. Call
create_postwithcontent,account_ids,media_ids: [<media_id>],platform_content, anddraft: true, unless the user already said to publish now or gave a time for this exact post. - Publish or schedule. After the user confirms, call
schedule_postwith thepost_idandscheduled_for(withtimezone) orpublish_now: true. - Check the result. Videos take a few minutes to process on each platform. Call
get_post_resultsafter a short wait and report which platforms published, with links, and any failure in plain words (seefix-failed-posts).
Good defaults
- Vertical video (9:16) suits TikTok, Reels and Shorts. For a wide video, check
get_platform_rulesbefore you pick a short-form format. - One video per post. To post two videos, make two posts.