KosmoKrator

social

Facebook CLI for AI Agents

Use the Facebook CLI from KosmoKrator to call Facebook tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write Bearer token auth

Facebook CLI Setup

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 --json
kosmokrator integrations:doctor facebook --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
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.

kosmo integrations:call facebook.facebook_list_pages '{
  "fields": "example_fields",
  "limit": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:facebook facebook_list_pages '{
  "fields": "example_fields",
  "limit": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs facebook --json
kosmo integrations:docs facebook.facebook_list_pages --json
kosmo integrations:schema facebook.facebook_list_pages --json
kosmo integrations:search "Facebook" --json
kosmo integrations:list --json

All CLI Functions

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.

Parameters
fields, limit

Generic CLI call

kosmo integrations:call facebook.facebook_list_pages '{"fields":"example_fields","limit":1}' --json

Provider shortcut

kosmo integrations:facebook facebook_list_pages '{"fields":"example_fields","limit":1}' --json

facebook.facebook_get_page

Read read

Get details for a specific Facebook Page by its ID. Returns page name, category, follower count, and other metadata.

Parameters
page_id, fields

Generic CLI call

kosmo integrations:call facebook.facebook_get_page '{"page_id":"example_page_id","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:facebook facebook_get_page '{"page_id":"example_page_id","fields":"example_fields"}' --json

facebook.facebook_list_posts

Read read

List posts published by a Facebook Page. Returns post IDs, messages, creation times, and engagement metrics.

Parameters
page_id, fields, limit, since, until

Generic CLI call

kosmo integrations:call facebook.facebook_list_posts '{"page_id":"example_page_id","fields":"example_fields","limit":1,"since":"example_since","until":"example_until"}' --json

Provider shortcut

kosmo integrations:facebook facebook_list_posts '{"page_id":"example_page_id","fields":"example_fields","limit":1,"since":"example_since","until":"example_until"}' --json

facebook.facebook_create_post

Write write

Publish a new post on a Facebook Page. The post will appear on the Page's timeline immediately unless scheduled.

Parameters
page_id, message, link, scheduled_publish_time

Generic CLI call

kosmo integrations:call facebook.facebook_create_post '{"page_id":"example_page_id","message":"example_message","link":"example_link","scheduled_publish_time":"example_scheduled_publish_time"}' --json

Provider shortcut

kosmo integrations:facebook facebook_create_post '{"page_id":"example_page_id","message":"example_message","link":"example_link","scheduled_publish_time":"example_scheduled_publish_time"}' --json

facebook.facebook_get_post

Read read

Get details for a specific Facebook post by its ID. Returns the post content, creation time, and engagement metrics.

Parameters
post_id, fields

Generic CLI call

kosmo integrations:call facebook.facebook_get_post '{"post_id":"example_post_id","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:facebook facebook_get_post '{"post_id":"example_post_id","fields":"example_fields"}' --json

facebook.facebook_list_insights

Read read

Get engagement and performance metrics (insights) for a Facebook Page. Supports metrics like page_impressions, page_engaged_users, page_post_engagements, and more.

Parameters
page_id, metric, period, since, until

Generic CLI call

kosmo integrations:call facebook.facebook_list_insights '{"page_id":"example_page_id","metric":"example_metric","period":"example_period","since":"example_since","until":"example_until"}' --json

Provider shortcut

kosmo integrations:facebook facebook_list_insights '{"page_id":"example_page_id","metric":"example_metric","period":"example_period","since":"example_since","until":"example_until"}' --json

facebook.facebook_get_current_user

Read read

Get the authenticated user's Facebook profile information, including name and user ID.

Parameters
fields

Generic CLI call

kosmo integrations:call facebook.facebook_get_current_user '{"fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:facebook facebook_get_current_user '{"fields":"example_fields"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

facebook.facebook_list_pages

List all Facebook Pages the authenticated user manages. Returns page IDs, names, and access tokens for further operations.

Operation
Read read
Schema command
kosmo integrations:schema facebook.facebook_list_pages --json
ParameterTypeRequiredDescription
fields string no Comma-separated list of fields to return per page (e.g. "id,name,category,fan_count,about"). Defaults to "id,name,category".
limit integer no Maximum number of pages to return per request.

facebook.facebook_get_page

Get details for a specific Facebook Page by its ID. Returns page name, category, follower count, and other metadata.

Operation
Read read
Schema command
kosmo integrations:schema facebook.facebook_get_page --json
ParameterTypeRequiredDescription
page_id string yes The Facebook Page ID.
fields string no Comma-separated list of fields to return (e.g. "id,name,category,fan_count,about,website,phone"). Defaults to "id,name,category,fan_count,about".

facebook.facebook_list_posts

List posts published by a Facebook Page. Returns post IDs, messages, creation times, and engagement metrics.

Operation
Read read
Schema command
kosmo integrations:schema facebook.facebook_list_posts --json
ParameterTypeRequiredDescription
page_id string yes The Facebook Page ID.
fields string no Comma-separated list of fields to return per post (e.g. "id,message,created_time,attachments,insights"). Defaults to "id,message,created_time".
limit integer no Maximum number of posts to return per request.
since string no Only return posts created after this UNIX timestamp or ISO date.
until string no Only return posts created before this UNIX timestamp or ISO date.

facebook.facebook_create_post

Publish a new post on a Facebook Page. The post will appear on the Page's timeline immediately unless scheduled.

Operation
Write write
Schema command
kosmo integrations:schema facebook.facebook_create_post --json
ParameterTypeRequiredDescription
page_id string yes The Facebook Page ID to publish the post on.
message string yes The text content of the post.
link string no A URL to attach to the post (e.g. "https://example.com/article").
scheduled_publish_time string no UNIX timestamp to schedule the post for future publication. The post will be saved as a draft until this time.

facebook.facebook_get_post

Get details for a specific Facebook post by its ID. Returns the post content, creation time, and engagement metrics.

Operation
Read read
Schema command
kosmo integrations:schema facebook.facebook_get_post --json
ParameterTypeRequiredDescription
post_id string yes The Facebook Post ID.
fields string no 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.

Operation
Read read
Schema command
kosmo integrations:schema facebook.facebook_list_insights --json
ParameterTypeRequiredDescription
page_id string yes The Facebook Page ID.
metric string no 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.

Operation
Read read
Schema command
kosmo integrations:schema facebook.facebook_get_current_user --json
ParameterTypeRequiredDescription
fields string no 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.