自动化运营 Facebook 主页
简介
生产级 Facebook Graph API 自动化工具,支持图文发布、Token 全生命周期管理及速率限制保护,适合构建安全可靠的 Facebook Page 运营流水线。
原始描述
Automate Facebook Page posting and token management using Graph API with retry-safe, rate-limit-aware workflows for text and image content.
通过你的 Agent 添加
安装目录:ai-agent-52598/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
Facebook Graph API Skill (Advanced)
Purpose
Production-oriented guide for building Facebook Graph API workflows for Pages: publishing posts (text + image), managing tokens, and operating Page content safely using direct HTTPS calls.
Best fit
- Page posting automation with images (DALL-E generated or external URL)
- Token management (short-lived → long-lived → page token)
- Retry-safe, rate-limit-aware production pipelines
Not a fit
- Personal profile posting (not supported by Graph API for third-party apps)
- Ads / Marketing API workflows
- Browser-based OAuth flows
Quick orientation
agents/fb_token_helper.py ← Get & exchange tokens (run this first!)
agents/fb_publisher_agent.py ← Post text / images to Page
config.py ← All env vars
test_fb_connection.py ← Verify token is working
Token Flow
Short-lived User Token (1-2h)
↓ GET /oauth/access_token?grant_type=fb_exchange_token
Long-lived User Token (60 days)
↓ GET /me/accounts
Page Access Token (never expires*)
- Personal profile posting (not supported by Graph API for third-party apps)
- Ads / Marketing API workflows
- Browser-based OAuth flows
Quick orientation
agents/fb_token_helper.py ← Get & exchange tokens (run this first!)
agents/fb_publisher_agent.py ← Post text / images to Page
config.py ← All env vars
test_fb_connection.py ← Verify token is working
Token Flow
Short-lived User Token (1-2h)
↓ GET /oauth/access_token?grant_type=fb_exchange_token
Long-lived User Token (60 days)
↓ GET /me/accounts
Page Access Token (never expires*)
agents/fb_token_helper.py ← Get & exchange tokens (run this first!)
agents/fb_publisher_agent.py ← Post text / images to Page
config.py ← All env vars
test_fb_connection.py ← Verify token is working
Short-lived User Token (1-2h)
↓ GET /oauth/access_token?grant_type=fb_exchange_token
Long-lived User Token (60 days)
↓ GET /me/accounts
Page Access Token (never expires*)
*Until user changes password or revokes app.
Required Environment Variables
FB_APP_ID=... # From Meta for Developers
FB_APP_SECRET=... # App secret
FB_PAGE_ID=... # Target Fanpage ID
FB_PAGE_ACCESS_TOKEN=... # From fb_token_helper.py
Key API Endpoints
Post text
POST /v21.0/{page_id}/feed
message=...
access_token={page_token}
Upload photo (unpublished)
FB_APP_ID=... # From Meta for Developers
FB_APP_SECRET=... # App secret
FB_PAGE_ID=... # Target Fanpage ID
FB_PAGE_ACCESS_TOKEN=... # From fb_token_helper.py
Post text
POST /v21.0/{page_id}/feed
message=...
access_token={page_token}
POST /v21.0/{page_id}/photos
url={image_url}
published=false
access_token={page_token}
→ Returns: { "id": "PHOTO_ID" }
Post with photo
POST /v21.0/{page_id}/feed
message=...
attached_media[0]={"media_fbid":"PHOTO_ID"}
access_token={page_token}
Scheduled post
POST /v21.0/{page_id}/feed
message=...
scheduled_publish_time={unix_timestamp}
published=false
access_token={page_token}
Required Permissions
Permission
Purpose
pages_manage_posts
Create/edit posts
pages_read_engagement
Read reactions, comments
pages_show_list
List managed pages
public_profile
Basic user identity
Rate Limits
- 200 calls/hour/user token
- Implement retry with exponential backoff (see fb_publisher_agent.py)
- POST 4-5 times/day max per Page for safety
Security
- Never log tokens or app secrets
- Store all secrets in .env (ignored by git)
- Validate webhook signatures if using webhooks
- Monitor token validity daily with a cron job
POST /v21.0/{page_id}/feed
message=...
attached_media[0]={"media_fbid":"PHOTO_ID"}
access_token={page_token}
POST /v21.0/{page_id}/feed
message=...
scheduled_publish_time={unix_timestamp}
published=false
access_token={page_token}
Required Permissions
Permission
Purpose
pages_manage_posts
Create/edit posts
pages_read_engagement
Read reactions, comments
pages_show_list
List managed pages
public_profile
Basic user identity
Rate Limits
- 200 calls/hour/user token
- Implement retry with exponential backoff (see fb_publisher_agent.py)
- POST 4-5 times/day max per Page for safety
Security
- Never log tokens or app secrets
- Store all secrets in .env (ignored by git)
- Validate webhook signatures if using webhooks
- Monitor token validity daily with a cron job
| Permission | Purpose |
|---|---|
pages_manage_posts |
Create/edit posts |
pages_read_engagement |
Read reactions, comments |
pages_show_list |
List managed pages |
public_profile |
Basic user identity |
- 200 calls/hour/user token
- Implement retry with exponential backoff (see fb_publisher_agent.py)
- POST 4-5 times/day max per Page for safety
Security
- Never log tokens or app secrets
- Store all secrets in .env (ignored by git)
- Validate webhook signatures if using webhooks
- Monitor token validity daily with a cron job
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。