keyapi-facebook-analysis
Explore and analyze public Facebook profiles, pages, and groups — from profile details and content feeds to group activity, events, and identifier resolution.
This skill provides comprehensive public Facebook intelligence using the KeyAPI MCP service. It enables retrieval of profile details (by URL or numeric ID), published posts, photos, Reels, group details, group posts, future group events, and ID resolution for both profiles and groups — all through a unified, cache-first workflow.
Use this skill when you need to:
- - Retrieve a public Facebook profile's details, posts, photos, or Reels by URL
- Resolve a profile URL to its numeric profile ID for downstream API calls
- Analyze public Facebook group activity — posts, member details, and upcoming events
- Resolve a group URL to its numeric group ID
- Research brand pages, public figures, or community groups on Facebook
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Prerequisites
| Requirement | Details |
|---|
| KEYAPITOKEN | A valid API token from keyapi.ai. Register at the site to obtain your free token. Set it as an environment variable: INLINECODE0 |
| Node.js |
v18 or higher |
|
Dependencies | Run
npm install in the skill directory to install
@modelcontextprotocol/sdk |
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
MCP Server Configuration
All tool calls in this skill target the KeyAPI Facebook MCP server:
CODEBLOCK0
Setup (one-time):
CODEBLOCK1
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Analysis Scenarios
| User Need | Node(s) | Best For |
|---|
| Full profile details from a URL | INLINECODE3 | Quick profile snapshot without knowing the numeric ID |
| Resolve profile URL → numeric ID |
get_profile_id | ID resolution for use with
profile_posts,
profiles_photos,
profile_reels |
| Profile details by numeric ID |
profiles_details_by_id | Profile lookup when ID is already known |
| Published posts from a profile/page |
profile_posts | Content feed analysis, posting cadence |
| Photos from a profile/page |
profiles_photos | Visual content audit, photo library |
| Reels from a profile/page |
profile_reels | Short-video content analysis |
| Group details from a URL |
get_group_details | Group overview, member count, description |
| Resolve group URL → numeric group ID |
get_group_id | ID resolution for
get_group_posts and
get_group_future_events |
| Posts from a public group |
get_group_posts | Group activity monitoring, content analysis |
| Upcoming events in a group |
get_group_future_events | Event discovery, community activity tracking |
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Workflow
Step 1 — Identify Analysis Targets and Select Nodes
Clarify the research objective and map it to one or more nodes. Typical entry points:
- - Profile research by URL: Use
profile_details_by_url for a quick snapshot, OR use get_profile_id to obtain the numeric profile_id then call profiles_details_by_id. - Profile content audit: Call
get_profile_id first, then use profile_posts, profiles_photos, profile_reels with the numeric ID. - Group research: Use
get_group_details with the full URL, then get_group_id to obtain group_id for get_group_posts and get_group_future_events.
Critical: Three Distinct Identifier Types
Facebook endpoints require different identifiers depending on the endpoint:
| Identifier | Format | Used by |
|---|
| Profile URL | Full URL, e.g., INLINECODE31 | INLINECODE32 , INLINECODE33 |
| Numeric profile ID |
Integer string, e.g., 100063669491743 | profile_posts, profiles_photos, profiles_details_by_id |
| reels_profile_id | Base64 collection ID (opaque string) | profile_reels only |
| Group URL | Full group URL, e.g., https://www.facebook.com/groups/1270525996445602/ | get_group_details, get_group_id |
| Numeric group ID | Integer string, e.g., 1439220986320043 | get_group_posts, get_group_future_events |
profile_reels — Special reels_profile_id
profile_reels uses a distinct reels_profile_id parameter that is NOT the same as the numeric profile_id. This opaque base64 collection ID is obtained from the profile_details_by_url or profiles_details_by_id response data. You cannot derive it from the numeric profile ID alone.
Workflow: profile_details_by_url (or get_profile_id → profiles_details_by_id) → extract reels_profile_id from response → call profile_reels.
Public Content Only
All endpoints in this skill return data from public Facebook profiles, pages, and groups only. Private profiles, private groups, and content requiring login cannot be accessed.
Step 2 — Retrieve API Schema
Before calling any node, inspect its input schema to confirm required parameters and available options:
CODEBLOCK2
Step 3 — Call APIs and Cache Results Locally
Execute tool calls and persist responses to the local cache to avoid redundant API calls.
Calling a tool:
CODEBLOCK3
Example — get profile details by URL:
CODEBLOCK4
Example — resolve URL to profile ID, then get posts:
CODEBLOCK5
Example — get next page of posts using cursor:
CODEBLOCK6
Example — get profile Reels (requires reelsprofileid from profile details):
CODEBLOCK7
Example — resolve group URL, then get posts:
CODEBLOCK8
Example — get group details and future events:
CODEBLOCK9
Pagination:
| Endpoint | Pagination parameter | Notes |
|---|
INLINECODE58 , get_group_posts, INLINECODE60 | INLINECODE61 (string) | Pass cursor from previous response; omit for first call |
| INLINECODE62 |
cursor (string) | Also accepts optional
collection_id to scope to a specific album |
|
profile_reels |
cursor (string) | Pass cursor from previous response; omit for first call |
|
profile_details_by_url,
profiles_details_by_id,
get_profile_id,
get_group_details,
get_group_id | — | Single-call response |
get_group_posts sorting options:
| Value | Description |
|---|
| INLINECODE73 | Most recent posts first (default) |
| INLINECODE74 |
Highest engagement posts first |
|
RECENT_ACTIVITY | Posts with recent activity (comments/reactions) |
|
CHRONOLOGICAL_LISTINGS | Chronological order for listing-type posts |
Cache directory structure:
CODEBLOCK10
Cache-first policy:
Before every API call, check whether a cached result already exists for the given parameters. If a valid cache file exists, load from disk and skip the API call.
Step 4 — Synthesize and Report Findings
After collecting all API responses, produce a structured intelligence report:
For profile/page analysis:
- 1. Profile Overview — Name, numeric ID, profile type (personal/page), bio, follower count, verification status, category.
- Content Inventory — Post count, photo count, Reels count, posting frequency, content type distribution.
- Engagement Signals — Reaction counts, comment counts, share counts on posts.
- Visual Content — Photo collections, album topics, Reels themes.
For group analysis:
- 1. Group Overview — Name, numeric group ID, member count, privacy type (public), description, creation date.
- Activity Profile — Post frequency, top contributors, discussion themes.
- Event Calendar — Upcoming events, event type, organizer, date/time distribution.
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Common Rules
| Rule | Detail |
|---|
| Profile ID resolution | INLINECODE77 , profiles_photos, profiles_details_by_id require the numeric profile_id. Use get_profile_id or profile_details_by_url to obtain it from a URL. |
profile_reels identifier |
Requires
reels_profile_id (a base64 collection ID), NOT the numeric
profile_id. Extract it from
profile_details_by_url or
profiles_details_by_id response. |
|
Group ID resolution |
get_group_posts and
get_group_future_events require numeric
group_id. Use
get_group_id with the full group URL to obtain it. |
|
Public content only | All endpoints return data from public profiles, pages, and groups only. Private content is inaccessible. |
|
Cursor pagination | Use
cursor from the previous response for all paginated endpoints. Omit for the first call. |
|
profiles_photos collection | Pass optional
collection_id to scope photo results to a specific album. Leave empty to fetch all photos. |
|
Success check |
code = 0 → success. Any other value → failure. Always check the response code before processing data. |
|
Retry on 500 | If
code = 500, retry the identical request up to 3 times with a 2–3 second pause between attempts before reporting the error. |
|
Cache first | Always check the local
.keyapi-cache/ directory before issuing a live API call. |
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Error Handling
| Code | Meaning | Action |
|---|
| INLINECODE98 | Success | Continue workflow normally |
| INLINECODE99 |
Bad request — invalid or missing parameters | Validate URL format; ensure numeric IDs are strings, not integers; check
reels_profile_id source |
|
401 | Unauthorized — token missing or expired | Confirm
KEYAPI_TOKEN is set correctly; visit
keyapi.ai to renew |
|
403 | Forbidden — plan quota exceeded or feature restricted | Review plan limits at
keyapi.ai |
|
404 | Resource not found — profile or group may be private or deleted | Verify the URL; private profiles and groups cannot be accessed |
|
429 | Rate limit exceeded | Wait 60 seconds, then retry |
|
500 | Internal server error | Retry up to 3 times with a 2–3 second pause; if it persists, log the full request and response and skip this node |
| Other non-0 | Unexpected error | Log the full response body and surface the error message to the user |
keyapi-facebook-analysis
探索和分析公开的Facebook个人主页、专页和群组——涵盖个人资料详情、内容动态、群组活动、事件以及标识符解析。
本技能通过KeyAPI MCP服务提供全面的公开Facebook情报。它支持获取个人资料详情(通过URL或数字ID)、已发布的帖子、照片、Reels、群组详情、群组帖子、未来群组活动,以及个人主页和群组的ID解析——全部通过统一的缓存优先工作流实现。
当您需要以下功能时使用此技能:
- - 通过URL获取公开Facebook个人主页的详情、帖子、照片或Reels
- 将个人主页URL解析为数字ID,供下游API调用
- 分析公开Facebook群组活动——帖子、成员详情和即将举办的活动
- 将群组URL解析为数字群组ID
- 研究Facebook上的品牌专页、公众人物或社区群组
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
前提条件
| 要求 | 详情 |
|---|
| KEYAPITOKEN | 来自keyapi.ai的有效API令牌。在网站上注册以获取免费令牌。将其设置为环境变量:export KEYAPITOKEN=yourtoken_here |
| Node.js |
v18或更高版本 |
|
依赖项 | 在技能目录中运行npm install以安装@modelcontextprotocol/sdk |
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
MCP服务器配置
本技能中的所有工具调用均指向KeyAPI Facebook MCP服务器:
服务器URL:https://mcp.keyapi.ai/facebook/mcp
认证头:Authorization: Bearer $KEYAPI_TOKEN
设置(一次性):
bash
1. 安装依赖项
npm install
2. 设置您的API令牌(在https://keyapi.ai/免费获取)
export KEYAPI
TOKEN=yourtoken_here
3. 列出所有可用工具以验证连接
node scripts/run.js --platform facebook --list-tools
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
分析场景
| 用户需求 | 节点 | 最佳用途 |
|---|
| 通过URL获取完整个人资料详情 | profiledetailsbyurl | 无需知道数字ID即可快速获取个人资料快照 |
| 解析个人主页URL → 数字ID |
getprofile
id | ID解析,用于profileposts、profiles
photos、profilereels |
| 通过数字ID获取个人资料详情 | profiles
detailsby_id | 已知ID时查找个人资料 |
| 个人主页/专页已发布的帖子 | profile_posts | 内容动态分析、发布频率 |
| 个人主页/专页的照片 | profiles_photos | 视觉内容审计、照片库 |
| 个人主页/专页的Reels | profile_reels | 短视频内容分析 |
| 通过URL获取群组详情 | get
groupdetails | 群组概览、成员数量、描述 |
| 解析群组URL → 数字群组ID | get
groupid | ID解析,用于get
groupposts和get
groupfuture_events |
| 公开群组的帖子 | get
groupposts | 群组活动监控、内容分析 |
| 群组中即将举办的活动 | get
groupfuture_events | 活动发现、社区活动追踪 |
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
工作流
步骤1 — 确定分析目标并选择节点
明确研究目标并将其映射到一个或多个节点。典型入口点:
- - 通过URL进行个人主页研究:使用profiledetailsbyurl获取快速快照,或使用getprofileid获取数字profileid,然后调用profilesdetailsbyid。
- 个人主页内容审计:先调用getprofileid,然后使用数字ID调用profileposts、profilesphotos、profilereels。
- 群组研究:使用完整URL调用getgroupdetails,然后使用getgroupid获取groupid,用于getgroupposts和getgroupfutureevents。
关键:三种不同的标识符类型
Facebook端点根据端点不同需要不同的标识符:
| 标识符 | 格式 | 使用方 |
|---|
| 个人主页URL | 完整URL,例如https://www.facebook.com/mantraindianfolsom | profiledetailsbyurl、getprofileid |
| 数字个人主页ID |
整数字符串,例如100063669491743 | profileposts、profilesphotos、profilesdetailsbyid |
| reelsprofileid | Base64集合ID(不透明字符串) | 仅profile_reels |
| 群组URL | 完整群组URL,例如https://www.facebook.com/groups/1270525996445602/ | getgroupdetails、getgroupid |
| 数字群组ID | 整数字符串,例如1439220986320043 | getgroupposts、getgroupfuture_events |
profilereels — 特殊的reelsprofile_id
profilereels使用一个独特的reelsprofileid参数,该参数不同于数字profileid。这个不透明的base64集合ID从profiledetailsbyurl或profilesdetailsbyid响应数据中获取。您无法仅从数字个人主页ID推导出它。
工作流:profiledetailsbyurl(或getprofileid → profilesdetailsbyid)→ 从响应中提取reelsprofileid → 调用profile_reels。
仅限公开内容
本技能中的所有端点仅返回公开Facebook个人主页、专页和群组的数据。无法访问私人个人主页、私人群组和需要登录的内容。
步骤2 — 获取API模式
在调用任何节点之前,检查其输入模式以确认所需参数和可用选项:
bash
node scripts/run.js --platform facebook --schema <工具名称>
示例
node scripts/run.js --platform facebook --schema profile
detailsby_url
node scripts/run.js --platform facebook --schema get
groupposts
步骤3 — 调用API并将结果缓存到本地
执行工具调用并将响应持久化到本地缓存,以避免重复的API调用。
调用工具:
bash
单次调用,美化输出
node scripts/run.js --platform facebook --tool <工具名称> \
--params
--pretty
强制获取最新数据,跳过缓存
node scripts/run.js --platform facebook --tool <工具名称> \
--params --no-cache --pretty
示例 — 通过URL获取个人资料详情:
bash
node scripts/run.js --platform facebook --tool profiledetailsby_url \
--params {url:https://www.facebook.com/mantraindianfolsom} --pretty
示例 — 将URL解析为个人主页ID,然后获取帖子:
bash
步骤1:将URL解析为数字profile_id
node scripts/run.js --platform facebook --tool getprofileid \
--params {url:https://www.facebook.com/mantraindianfolsom} --pretty
步骤2:使用数字profile_id获取帖子
node scripts/run.js --platform facebook --tool profile_posts \
--params {profile_id:100063669491743} --pretty
示例 — 使用游标获取下一页帖子:
bash
node scripts/run.js --platform facebook --tool profile_posts \
--params {profile_id:100063669491743,cursor:<来自前一个响应的游标>} --pretty
示例 — 获取个人主页Reels(需要来自个人资料详情的reelsprofileid):
bash
步骤1:获取个人资料详情以获取reelsprofileid
node scripts/run.js --platform facebook --tool profiledetailsby_url \
--params {url:https://www.facebook.com/examplepage} --pretty
从响应中提取reelsprofileid
步骤2:使用reelsprofileid获取reels
node scripts/run.js --platform facebook --tool profile_reels \
--params {reelsprofileid:<来自响应的reelsprofileid>} --pretty
示例 — 解析群组URL,然后获取帖子:
bash
步骤1:将群组URL解析为