facebooklisted
Install: claude install-skill AceDataCloud/Skills
Call the **Facebook Graph API** (`graph.facebook.com`) with `curl + jq`. The
connector injects `$FACEBOOK_ACCESS_TOKEN` (a **Page** access token with
`pages_manage_posts` + `pages_read_engagement`) and optionally
`$FACEBOOK_PAGE_ID`. Never echo them.
The Graph API publishes only to a **Facebook Page** you manage — it cannot post
to a personal profile timeline.
### Resolve the Page id
If `$FACEBOOK_PAGE_ID` is set, use it. Otherwise derive it from the token — try
the **Page-token** path first (`/me` is the Page), then fall back to the
**user-token** path (`/me/accounts` → first managed Page), so either token type
the connector accepts resolves cleanly:
```bash
if [ -n "$FACEBOOK_PAGE_ID" ]; then
PAGE="$FACEBOOK_PAGE_ID"
else
# Page access token: /me IS the Page
PAGE=$(curl -sS "https://graph.facebook.com/v21.0/me?fields=id,name&access_token=$FACEBOOK_ACCESS_TOKEN" | jq -r 'select(.name).id // empty')
if [ -z "$PAGE" ]; then
# User access token: list the managed Pages, take the first
PAGE=$(curl -sS "https://graph.facebook.com/v21.0/me/accounts?access_token=$FACEBOOK_ACCESS_TOKEN" | jq -r '.data[0].id // empty')
fi
fi
echo "page_id=$PAGE"
```
Errors are JSON with `error.message` / `error.code` — show them verbatim.
`401` / `OAuthException` → token expired or missing scope; a null `PAGE` → the
token isn't a Page token / manages no Page (see Gotchas). Reconnect if needed.
> If the user token path is used, `/me/accounts` also returns a per-Page
> `access_to