Skip to main content

Facebook

Draft Facebook posts into a reviewable AutessaDB table, publish them to a profile, Page, or group, sync a Page's existing posts, and pull Page and Ads insights for reporting.

Every tool on this page requires a Facebook connector (see Connectors); pass its ID as connectorId. Posts live as rows in an AutessaDB table the connector provisions: drafts start at status = DRAFT and carry a publish target (PROFILE, PAGE, or GROUP), and publishing flips the row to PUBLISHED with the Facebook post ID stored for stats lookups. The insights tools are read-only reporting calls against the Graph API and the Marketing API.

Create a draft post TOOLFACEBOOK_CREATE_DRAFT_POST​

Inserts a new draft row with status = DRAFT — nothing is posted to Facebook yet. Alongside postContent and the optional mediaUrl image, the draft records where it will be published: targetType is PROFILE, PAGE, or GROUP, with targetId holding the Page or group ID (null for PROFILE) and targetName a human-readable label for reviewers. Returns the new recordId.

Example​

Tool config
{
"toolType": "FACEBOOK_CREATE_DRAFT_POST",
"connectorId": "V1StGXR8Z5",
"postContent": "@@{POST_CONTENT}",
"mediaUrl": "@@{IMAGE_URL}",
"targetType": "PAGE",
"targetId": "104857361234567",
"targetName": "Acme Robotics"
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    postContent
    Type
    string
    Description
    The post text content
  • Name
    mediaUrl
    Type
    string · optional
    Description
    Optional - URL of image to attach
  • Name
    targetType
    Type
    string
    Description
    PROFILE, PAGE, or GROUP
  • Name
    targetId
    Type
    string
    Description
    Page or Group ID (null for PROFILE)
  • Name
    targetName
    Type
    string
    Description
    Display name for the target

Update a draft post TOOLFACEBOOK_UPDATE_DRAFT_POST​

Edits an existing draft row in place. Content, media, and all three target fields are optional — only the fields you provide change, so you can retarget a draft from one Page to another without rewriting it. This edits the AutessaDB row only; it cannot modify a post that has already been published.

Example​

Tool config
{
"toolType": "FACEBOOK_UPDATE_DRAFT_POST",
"connectorId": "V1StGXR8Z5",
"recordId": 42,
"postContent": "@@{REVISED_CONTENT}"
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    recordId
    Type
    integer
    Description
    AutessaDB record ID of the draft to update
  • Name
    postContent
    Type
    string · optional
    Description
    Optional - new post content
  • Name
    mediaUrl
    Type
    string · optional
    Description
    Optional - new URL of image to attach
  • Name
    targetType
    Type
    string · optional
    Description
    Optional - PROFILE, PAGE, or GROUP
  • Name
    targetId
    Type
    string · optional
    Description
    Optional - new Page or Group ID
  • Name
    targetName
    Type
    string · optional
    Description
    Optional - new display name for the target

Publish a post TOOLFACEBOOK_PUBLISH_POST​

Reads the draft row and publishes it to the target recorded on the row — Page posts are made with the Page's own access token, and PAGE/GROUP targets require a target ID. The row must still be in DRAFT status; republishing fails with ALREADY_PUBLISHED. On success the row is updated to status = PUBLISHED with the Facebook post ID stored for later stats lookups.

Example​

Tool config
{
"toolType": "FACEBOOK_PUBLISH_POST",
"connectorId": "V1StGXR8Z5",
"recordId": 42
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    recordId
    Type
    integer
    Description
    AutessaDB record ID of the draft to publish

Get post stats TOOLFACEBOOK_GET_POST_STATS​

Looks up the Facebook post ID on a published row and fetches live engagement from the Graph API — like and comment totals plus the post's message and created time. Only works for rows that have been published (or synced) and therefore carry a Facebook post ID.

Example​

Tool config
{
"toolType": "FACEBOOK_GET_POST_STATS",
"connectorId": "V1StGXR8Z5",
"recordId": 42
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    recordId
    Type
    integer
    Description
    AutessaDB record ID of the published post

Get all posts TOOLFACEBOOK_GET_ALL_POSTS​

Lists rows from the connector's posts table — drafts and published posts together by default, or filtered with status (DRAFT, PUBLISHED). pageSize defaults to 50 and caps at 100. Reads the AutessaDB table, so results include synced Page posts as well as agent-created drafts.

Example​

Tool config
{
"toolType": "FACEBOOK_GET_ALL_POSTS",
"connectorId": "V1StGXR8Z5",
"status": "DRAFT",
"pageSize": 50
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    status
    Type
    string · optional
    Description
    Optional - filter by status: DRAFT, PUBLISHED
  • Name
    pageSize
    Type
    integer · optional
    Description
    Optional - max posts to retrieve (default 50, max 100)

Get post by ID TOOLFACEBOOK_GET_POST_BY_ID​

Fetches a single row from the posts table by its AutessaDB rowId, returning content, status, media URL, target details, and the stored Facebook post ID. Use it to inspect one specific draft or published post without paging through the full list.

Example​

Tool config
{
"toolType": "FACEBOOK_GET_POST_BY_ID",
"connectorId": "V1StGXR8Z5",
"rowId": 42
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    rowId
    Type
    integer
    Description
    AutessaDB row ID of the post to retrieve

Sync posts TOOLFACEBOOK_SYNC_POSTS​

Imports a Page's existing posts from the Graph API into the AutessaDB table as PUBLISHED rows, skipping posts that are already present. Results are cached for 24 hours — a second sync inside that window returns the cached summary unless forceRefresh is true. Run this once after connecting so the table reflects the Page's history, then periodically to pick up posts made outside Autessa.

Example​

Tool config
{
"toolType": "FACEBOOK_SYNC_POSTS",
"connectorId": "V1StGXR8Z5",
"pageId": "104857361234567",
"forceRefresh": false
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    pageId
    Type
    string
    Description
    The Facebook Page ID to sync posts from
  • Name
    forceRefresh
    Type
    boolean · optional
    Description
    Optional: bypass daily cache if true

Get Page insights TOOLFACEBOOK_GET_PAGE_INSIGHTS​

Fetches Page-level metrics from the Graph API Insights endpoint: unique impressions, post engagements, daily new follows, and video views — the set of metrics Meta still supports after its 2024–2025 insights deprecations. period buckets the numbers by day, week, or days_28, and the optional datePreset (for example last_30d) selects the reporting window.

Example​

Tool config
{
"toolType": "FACEBOOK_GET_PAGE_INSIGHTS",
"connectorId": "V1StGXR8Z5",
"pageId": "104857361234567",
"period": "day",
"datePreset": "last_30d"
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    pageId
    Type
    string
    Description
    Facebook Page ID to get insights for
  • Name
    period
    Type
    string
    Description
    Period for metrics: day, week, days_28 (default: day)
  • Name
    datePreset
    Type
    string · optional
    Description
    Optional: today, yesterday, this_week, last_week, this_month, last_month, last_7d, last_30d, last_90d

List ad accounts TOOLFACEBOOK_LIST_AD_ACCOUNTS​

Lists the ad accounts the connected user can access, including each account's ID (the act_... form the other ads tools expect), name, and status. This is the usual first step of an ads-reporting flow: find the account, then list its campaigns or pull insights.

Example​

Tool config
{
"toolType": "FACEBOOK_LIST_AD_ACCOUNTS",
"connectorId": "V1StGXR8Z5"
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.

List campaigns TOOLFACEBOOK_LIST_CAMPAIGNS​

Lists campaigns in an ad account, optionally filtered by status (ACTIVE, PAUSED, DELETED, ARCHIVED), up to limit (default 50). Each campaign's ID can be passed to the ads-insights tool for per-campaign performance.

Example​

Tool config
{
"toolType": "FACEBOOK_LIST_CAMPAIGNS",
"connectorId": "V1StGXR8Z5",
"adAccountId": "act_123456789",
"status": "ACTIVE",
"limit": 50
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    adAccountId
    Type
    string
    Description
    Ad account ID (e.g., "act_123456789")
  • Name
    status
    Type
    string · optional
    Description
    Optional - filter by status: ACTIVE, PAUSED, DELETED, ARCHIVED
  • Name
    limit
    Type
    integer · optional
    Description
    Optional - max campaigns to retrieve (default 50)

Get ads insights TOOLFACEBOOK_GET_ADS_INSIGHTS​

Pulls performance metrics from the Marketing API for any level of the ads hierarchy — pass an ad account, campaign, ad set, or ad ID as objectId. Returns spend, impressions, clicks, CTR, CPC, CPM, reach, and frequency, plus action breakdowns (conversions and cost per action) when available. datePreset selects the window (for example last_30d or lifetime) and level re-aggregates account-level queries by campaign, adset, or ad.

Example​

Tool config
{
"toolType": "FACEBOOK_GET_ADS_INSIGHTS",
"connectorId": "V1StGXR8Z5",
"objectId": "act_123456789",
"datePreset": "last_30d",
"level": "campaign"
}
This tool type requires a connected external account. Pass the connector's ID as connectorId in the tool configuration.

Configuration fields

  • Name
    connectorId
    Type
    string (ID)
    Description
    Required string (ID) value. References a connector by ID.
  • Name
    objectId
    Type
    string
    Description
    Ad account ID, campaign ID, ad set ID, or ad ID
  • Name
    datePreset
    Type
    string · optional
    Description
    Optional: today, yesterday, this_week, last_week, last_7d, last_14d, last_30d, last_90d, this_month, last_month, lifetime
  • Name
    level
    Type
    string · optional
    Description
    Optional: account, campaign, adset, ad (default: derives from objectId type)