instagram-publisher
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstagram Publisher
Instagram 发布工具
When to use
使用场景
Use the Instagram Publisher when you need to publish carousel posts directly to an Instagram Business account. This skill handles the full workflow: uploading images to imgBB (requires your own API key from https://api.imgbb.com/), creating Instagram media containers via the Graph API, and publishing the carousel. It supports 2-10 JPEG images per post.
当您需要直接向Instagram Business账户发布轮播帖时,可使用本Instagram发布工具。该工具可处理完整工作流:将图片上传至imgBB(需从https://api.imgbb.com/获取您自己的API密钥),通过Graph API创建Instagram媒体容器并发布轮播帖。它支持每篇帖子包含2-10张JPEG图片。
Instructions
使用说明
Workflow
工作流程
- List JPEG files in sorted by name. If no files found: stop and ask the user to add images before continuing.
squads/{squad}/output/images/ - Present the image list to the user with AskUserQuestion to confirm order.
- Extract the caption from the content draft:
- Use the hook slide text + CTA slide text
- Max 2200 characters (Instagram limit)
- Run the publish script:
Add
node --env-file=.env squads/{squad}/tools/publish.js \ --images "<comma-separated-ordered-paths>" \ --caption "<caption>"to test the full flow without actually publishing.--dry-run - On success: save the post URL and post ID to the step output file.
- On failure: display the error and ask the user how to proceed.
- 按名称排序列出目录下的JPEG文件。 如果未找到文件:停止操作并提示用户添加图片后再继续。
squads/{squad}/output/images/ - 通过AskUserQuestion向用户展示图片列表,确认顺序。
- 从内容草稿中提取文案:
- 使用钩子幻灯片文本+CTA幻灯片文本
- 最多2200字符(Instagram限制)
- 运行发布脚本:
添加
node --env-file=.env squads/{squad}/tools/publish.js \ --images "<comma-separated-ordered-paths>" \ --caption "<caption>"参数可在不实际发布的情况下测试完整流程。--dry-run - 成功时:将帖子URL和帖子ID保存至步骤输出文件。
- 失败时:显示错误并询问用户后续操作。
Constraints
约束条件
- Images: JPEG only, 2-10 per carousel
- Caption: max 2200 characters
- Requires Instagram Business account (not Personal or Creator)
- Rate limit: 25 API-published posts per 24 hours
- 图片:仅支持JPEG格式,每个轮播帖包含2-10张
- 文案:最多2200字符
- 需使用Instagram Business账户(不支持个人或创作者账户)
- 速率限制:每24小时最多通过API发布25篇帖子
Setup (first-time)
首次设置
Copy to and fill in the two required variables:
.env.example.envINSTAGRAM_ACCESS_TOKEN=
INSTAGRAM_USER_ID=将复制为并填写两个必填变量:
.env.example.envINSTAGRAM_ACCESS_TOKEN=
INSTAGRAM_USER_ID=INSTAGRAM_ACCESS_TOKEN
INSTAGRAM_ACCESS_TOKEN
Pré-requisito: conta Instagram Business conectada a uma Página do Facebook, e um app criado em developers.facebook.com (tipo: Empresa).
Para obter um token de longa duração (válido 60 dias):
- Acesse seu app → Graph API Explorer
- No dropdown do topo, selecione seu app
- Clique em "Gerar token de acesso"
- Ative as permissões:
instagram_content_publishinstagram_basicpages_read_engagement
- Clique em "Gerar token de acesso" e autorize — você receberá um token de curta duração (1h)
- Converta para longa duração (60 dias) com este GET:
(APP_ID e APP_SECRET: seu app → Configurações → Básico)
https://graph.facebook.com/oauth/access_token ?grant_type=fb_exchange_token &client_id={APP_ID} &client_secret={APP_SECRET} &fb_exchange_token={TOKEN_CURTO} - Copie o da resposta e cole em
access_token.env
O token expira em 60 dias. Repita o processo para renovar.
前提条件:Instagram Business账户已关联至Facebook主页,且已在developers.facebook.com创建应用(类型:企业)。
获取长期访问令牌(有效期60天):
- 访问您的应用 → Graph API Explorer
- 在顶部下拉菜单中选择您的应用
- 点击**"生成访问令牌"**
- 启用以下权限:
instagram_content_publishinstagram_basicpages_read_engagement
- 点击**"生成访问令牌"**并授权 — 您将获得一个短期令牌(有效期1小时)
- 通过以下GET请求将其转换为长期令牌(有效期60天):
(APP_ID和APP_SECRET:您的应用 → 设置 → 基本信息)
https://graph.facebook.com/oauth/access_token ?grant_type=fb_exchange_token &client_id={APP_ID} &client_secret={APP_SECRET} &fb_exchange_token={TOKEN_CURTO} - 复制响应中的并粘贴至
access_token文件中.env
令牌有效期为60天。到期后重复上述流程进行续订。
INSTAGRAM_USER_ID
INSTAGRAM_USER_ID
- No Graph API Explorer (com o token acima), faça GET em:
/me/accounts - Localize sua Página do Facebook na resposta e anote o
id - Faça GET em:
/{page-id}?fields=instagram_business_account - Copie o dentro de
id— esse é o seu User IDinstagram_business_account
- 在Graph API Explorer(使用上述令牌)中,发送GET请求:
/me/accounts - 在响应中找到您的Facebook主页并记录其
id - 发送GET请求:
/{page-id}?fields=instagram_business_account - 复制中的
instagram_business_account— 这就是您的用户IDid
Available operations
可用操作
- Publish Carousel -- Upload images and publish a carousel post to Instagram
- Dry Run -- Test the full publishing flow without actually posting (use flag)
--dry-run - Image Upload -- Upload local JPEG images to imgBB (requires API key)
- Status Check -- Monitor media container processing status before publishing
- 发布轮播帖 -- 上传图片并向Instagram发布轮播帖
- 试运行 -- 在不实际发布的情况下测试完整发布流程(使用参数)
--dry-run - 图片上传 -- 将本地JPEG图片上传至imgBB(需API密钥)
- 状态检查 -- 在发布前监控媒体容器的处理状态