ai agent

# Facebook Graph API Skill (Advanced)

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "ai agent" with this command: npx skills add yunneetoichoi/ai-agent

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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Qwen Web Agent

Browser automation for 通义千问 (Qwen) web interface at qianwen.com. Use when the agent needs to ask questions to Qwen AI and get back responses via browser auto...

Registry SourceRecently Updated
Automation

bot File Processor

通用文件处理技能,用于批量重命名和格式转换。当用户需要批量重命名文件(添加前缀/后缀、替换文本、编号重命名、正则表达式重命名)或转换文件格式(图片格式转换、PDF与图片互转、DOCX转PDF、Markdown转PDF)时使用此技能。

Registry SourceRecently Updated
Automation

Ocean Chat

OceanBus-powered P2P messaging, shared address book, 1v1 meetup negotiation, and conversation threading for AI agents. Use when users want to manage contacts...

Registry SourceRecently Updated
Automation

BeerGaao 专业量化交易

A股/港股/美股量化分析工具,提供技术分析、策略生成、回测验证和风险管理功能

Registry SourceRecently Updated