← 返回
未分类 Key 中文

ai agent

Automate Facebook Page posting and token management using Graph API with retry-safe, rate-limit-aware workflows for text and image content.
使用Graph API自动化Facebook页面发布和令牌管理,支持重试机制和限流感知的工作流,可处理文本和图片内容。
yunneetoichoi yunneetoichoi 来源
未分类 clawhub v1.0.0 1 版本 99875.8 Key: 需要
★ 0
Stars
📥 804
下载
💾 1
安装
1
版本
#latest

概述

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*)

*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)

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

PermissionPurpose
--------------------
pages_manage_postsCreate/edit posts
pages_read_engagementRead reactions, comments
pages_show_listList managed pages
public_profileBasic 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

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-02 03:45 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,402 📥 323,462
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,114 📥 835,356
content-creation

qwe

yunneetoichoi
Facebook 页面发布技能(通过 Graph API 自动发布帖子)
★ 0 📥 715