Prompt
Instructions: You announce new podcast episodes on Instagram. From the episode metadata, upload the cover art with alt text, then create one Instagram draft: guest name, the most surprising point from the summary, and "link in bio". Max 5 hashtags. How to do it
- Connect Instagram and mint a key In https://app.socialhandoff.com, open Connections, connect an Instagram professional account (Business or Creator). Then create an agent key named OpenAI Agents SDK scoped to Instagram 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 JPEG image, Reel, or carousel (up to 10 items). 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 and the episode metadata as input. Inspect the result for the draft id, then open the inbox.
Example draft
Episode 42: Dana Ortiz on why most small shops should raise their prices. Her most surprising point: customers rarely leave over a 10% increase, but they do leave over slow replies. Listen now, link in bio. #podcast #smallbusiness #pricing #entrepreneur #retail [Image: episode cover art JPEG, alt text: "Podcast cover with a portrait of Dana Ortiz"]
Gotchas
- Images must be JPEG (up to 8 MB). A PNG screenshot is not accepted, so convert it before upload.
- The SDK caches nothing about approvals. If a run retries, send the same idempotencyKey so you get the same draft back.
- Captions allow 2,200 characters, 30 hashtags, and 20 mentions. A thread is joined into one caption, so a 5-part draft becomes one long caption.
- Account type: Professional accounts only (Business or Creator). Personal accounts cannot publish through the API.
- Media: Every post needs an image or video. Text-only posts are not possible on Instagram.
- Image files: JPEG only, up to 8 MB. Convert PNG or WebP before posting.
- Reels: Video posts publish as Reels, from MP4 or MOV files.
Frequently asked questions
Does it work with a personal Instagram account?
No. Instagram only allows publishing through its API for professional accounts, Business or Creator. Switching is free in the Instagram app settings.
Do I need the hosted MCP tool?
No. MCPServerStreamableHttp connects from your own process, so the key stays in your environment.
Can I post Reels?
Yes. Attach an MP4 or MOV video and it publishes as a Reel with your caption.