通过Graph API自动管理并发布内容到Facebook主页。全面支持:文本/图片帖子、轮播图(多图)、视频、Reels短视频、Story(图片/视频)、定时发布...
Skill đăng và quản lý nội dung Facebook Page qua Graph API v19.0 bằng Python.
bash
pip install requests
Xem hướng dẫn chi tiết: references/get-token.md
Tóm tắt nhanh:
pages_manage_posts, pages_read_engagement, pages_manage_engagement, publish_videoGET /me/accounts để lấy Page Access Token và Page IDTạo file scripts/fb_config.json:
json
{
"access_token": "EAAxxxxxxxxxxxxxxx",
"page_id": "123456789012345"
}
⚠️ Thêm vào
.gitignore, không commit file này!
scripts/fb_post.py#bash
python fb_post.py text --message "Nội dung bài viết"
bash
python fb_post.py photo --message "Caption" --images anh1.jpg
bash
python fb_post.py photo --message "Caption" --images a.jpg b.jpg c.jpg
bash
python fb_post.py video --message "Caption" --video clip.mp4
bash
python fb_post.py video --message "Caption" --video clip.mp4 --reel
bash
python fb_post.py story --type photo --media story.jpg
bash
python fb_post.py story --type video --media story.mp4
Thêm --schedule "YYYY-MM-DD HH:MM" vào bất kỳ lệnh text/photo/video:
bash
python fb_post.py text --message "Bài sáng thứ Hai" --schedule "2024-12-25 08:00"
python fb_post.py photo --message "Caption" --images anh.jpg --schedule "2024-12-25 10:00"
python fb_post.py video --message "Video mới" --video clip.mp4 --schedule "2024-12-25 20:00"
⏰ Thời gian phải sau hiện tại ít nhất 10 phút và không quá 6 tháng. Story không hỗ trợ hẹn giờ.
bash
python fb_post.py list-scheduled
bash
python fb_post.py delete --post-id 123456789_987654321
bash
python fb_post.py reschedule --post-id 123456789_987654321 --schedule "2024-12-26 09:00"
Permission cần thêm:
pages_manage_engagement
bash
python fb_post.py comment --post-id 123456789_987654321 --message "Nội dung comment"
bash
python fb_post.py reply --comment-id COMMENT_ID --message "Nội dung reply"
bash
python fb_post.py list-comments --post-id 123456789_987654321
bash
python fb_post.py delete-comment --comment-id COMMENT_ID
references/get-token.md — Hướng dẫn lấy Access Token từng bướcreferences/api-reference.md — Chi tiết endpoints, format, giới hạnpages_manage_engagementreferences/get-token.md phần Troubleshooting