Use the Facebook CLI from KosmoKrator to call Facebook tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Facebook can be configured headlessly with `kosmokrator integrations:configure facebook`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure facebook --set access_token="$FACEBOOK_ACCESS_TOKEN" --enable --read allow --write ask --jsonkosmokrator integrations:doctor facebook --jsonkosmokrator integrations:status --json
Credentials
Authentication type: Bearer tokenbearer_token. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
access_token
FACEBOOK_ACCESS_TOKEN
Secret secret
yes
Access Token
base_url
FACEBOOK_BASE_URL
URL url
no
Graph API Base URL
Call Facebook Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Facebook.
facebook.facebook_list_pages
Read read
List all Facebook Pages the authenticated user manages. Returns page IDs, names, and access tokens for further operations.
Get engagement and performance metrics (insights) for a Facebook Page. Supports metrics like page_impressions, page_engaged_users, page_post_engagements, and more.
Comma-separated list of fields to return (e.g. "id,message,created_time,attachments,shares,likes.summary(true)"). Defaults to "id,message,created_time,attachments".
facebook.facebook_list_insights
Get engagement and performance metrics (insights) for a Facebook Page. Supports metrics like page_impressions, page_engaged_users, page_post_engagements, and more.
Comma-separated list of insight metrics to retrieve (e.g. "page_impressions,page_engaged_users,page_post_engagements"). Omit to return all available metrics.
period
string
no
Aggregation period: "day", "week", "days_28", "month", or "lifetime". Defaults to "day".
since
string
no
Start date for the insight data (UNIX timestamp or ISO date).
until
string
no
End date for the insight data (UNIX timestamp or ISO date).
facebook.facebook_get_current_user
Get the authenticated user's Facebook profile information, including name and user ID.
Comma-separated list of fields to return (e.g. "id,name,email,picture"). Defaults to "id,name".
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.