Prompt
Read events/workshop-june.md. Write an Instagram caption announcing the workshop: date, city, what people will build, and that seats are limited to 30. Upload events/workshop-june.jpg with alt text and create an Instagram draft with the uploaded id. 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 Gemini CLI scoped to Instagram with draft and schedule permission.
- Add the server to settings.json In ~/.gemini/settings.json or the project .gemini/settings.json, add an mcpServers entry with httpUrl set to https://app.socialhandoff.com/mcp and a headers object carrying the bearer key.
- Attach media from the workspace Gemini CLI calls attach_media for the JPEG image, Reel, or carousel (up to 10 items): a public url, or the file as base64 data (up to 8 MB) with its mime type and alt text. Larger files go to POST https://app.socialhandoff.com/v1/media as multipart. The ids go into draft_post as mediaIds.
- Ask for the draft Run gemini in the project folder and give it the prompt. It shows each shell command and tool call before it runs.
- Review and approve Check the caption, hashtag count, and alt text on the approval card. On approval, the post publishes; if Instagram's daily quota is full, it is deferred by an hour.
Example draft
Build your first AI agent in one afternoon. June 14 in Lisbon: a hands-on workshop where you wire a small agent to real tools and leave with working code. Laptops required, experience optional. 30 seats. Sign up at the link in bio. #workshop #lisbon #aiagents #learntocode [Image: workshop-june.jpg, a poster with the date and city, alt text included]
Gotchas
- Only professional accounts (Business or Creator) can connect. A personal account is refused at connect time with instructions to switch.
- Gemini CLI reads project settings over user settings. A stale .gemini/settings.json in the repo can point at the wrong instance.
- Instagram refuses text-only posts. A draft can be saved as text first, but approving or scheduling it is refused with a clear error until an image or video is attached.
- 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
Can I post Reels?
Yes. Attach an MP4 or MOV video and it publishes as a Reel with your caption.
Which key does Gemini CLI use for the URL?
httpUrl for streamable HTTP. The url key means SSE and will not connect to the /mcp endpoint.
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.