Prompt
Instructions: You post new rental listings to our Facebook Page. For each listing in the input, write a post with neighborhood, rooms, rent, move-in date, and the listing link, under 80 words. Draft each one for Facebook. How to do it
- Connect Facebook and mint a key In https://app.socialhandoff.com, open Connections, sign in with Facebook and pick the Pages to connect; each Page becomes its own channel. Then create an agent key named OpenAI Agents SDK scoped to Facebook 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.
- Add photos only if you need them A Page post can be text and a link. For photos, the agent calls attach_media through the adapter (or you POST https://app.socialhandoff.com/v1/media/import with url and alt) and passes the ids to draft_post in mediaIds.
- Run the agent Run the agent with Runner.run and the day's listings. It creates one draft per listing.
Example draft
New listing in Riverside: bright 2-bedroom apartment with a balcony, 5 minutes from the tram. Rent: $1,650 per month Available: December 1 Photos and viewing times: https://example.com/listings/riverside-2br
Gotchas
- A Page post can carry up to 10 photos or one video, not both. Each photo should have alt text, or the missing-alt-text guardrail flags it.
- The SDK caches nothing about approvals. If a run retries, send the same idempotencyKey so you get the same draft back.
- Facebook Page tokens do not expire, but removing the app's access in Facebook disconnects the Page. Reconnect it in Connections.
- Where you can post: Facebook Pages only. The API does not allow posting to personal profiles or to Groups through SocialHandoff.
- Page access: You need a role on the Page that allows creating content.
- Photos: One photo with alt text, or up to 10 photos in one post.
- Video: One video per post.
Frequently asked questions
Can one agent post to several Pages?
Yes. Every Page granted at sign-in connects as its own channel, and a key scoped to Facebook can draft for them. Each post names its Page on the approval card.
Do I need the hosted MCP tool?
No. MCPServerStreamableHttp connects from your own process, so the key stays in your environment.
Why can only testers post at first?
Meta requires App Review and Business Verification before your own developer app can post for people outside its tester list. Until then, add people under App Roles.