@acedatacloud/skills 2026.721.0 → 2026.721.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acedatacloud/skills",
3
- "version": "2026.721.0",
3
+ "version": "2026.721.1",
4
4
  "description": "Agent Skills for AceDataCloud AI services — music, image, video generation, LLM chat, web search. Compatible with Claude Code, GitHub Copilot, Gemini CLI, OpenAI Codex, and 30+ AI coding agents.",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: facebook
3
+ description: Publish text, link or photo posts to your Facebook Page via the Facebook Pages API, and read your Page's recent posts. Use when the user wants to post to their Facebook Page, share a link, publish a photo, or review their own Page posts. Auth uses a Page access token (BYOC). 支持 Facebook 主页文本 / 链接 / 图片发帖。
4
+ when_to_use: |
5
+ Trigger when the user wants to publish a post (text, link or photo) to their
6
+ Facebook Page, cross-post an article, or review their own recent Page posts.
7
+ Publishing posts as their real Page — confirm the message + any link/photo
8
+ first. This posts to a Facebook Page, not a personal profile (the Graph API
9
+ cannot post to personal timelines).
10
+ connections: [facebook]
11
+ allowed_tools: [Bash]
12
+ license: Apache-2.0
13
+ metadata:
14
+ author: acedatacloud
15
+ version: "1.0"
16
+ ---
17
+
18
+ Call the **Facebook Graph API** (`graph.facebook.com`) with `curl + jq`. The
19
+ connector injects `$FACEBOOK_ACCESS_TOKEN` (a **Page** access token with
20
+ `pages_manage_posts` + `pages_read_engagement`) and optionally
21
+ `$FACEBOOK_PAGE_ID`. Never echo them.
22
+
23
+ The Graph API publishes only to a **Facebook Page** you manage — it cannot post
24
+ to a personal profile timeline.
25
+
26
+ ### Resolve the Page id
27
+
28
+ If `$FACEBOOK_PAGE_ID` is set, use it. Otherwise derive it from the token — try
29
+ the **Page-token** path first (`/me` is the Page), then fall back to the
30
+ **user-token** path (`/me/accounts` → first managed Page), so either token type
31
+ the connector accepts resolves cleanly:
32
+
33
+ ```bash
34
+ if [ -n "$FACEBOOK_PAGE_ID" ]; then
35
+ PAGE="$FACEBOOK_PAGE_ID"
36
+ else
37
+ # Page access token: /me IS the Page
38
+ PAGE=$(curl -sS "https://graph.facebook.com/v21.0/me?fields=id,name&access_token=$FACEBOOK_ACCESS_TOKEN" | jq -r 'select(.name).id // empty')
39
+ if [ -z "$PAGE" ]; then
40
+ # User access token: list the managed Pages, take the first
41
+ PAGE=$(curl -sS "https://graph.facebook.com/v21.0/me/accounts?access_token=$FACEBOOK_ACCESS_TOKEN" | jq -r '.data[0].id // empty')
42
+ fi
43
+ fi
44
+ echo "page_id=$PAGE"
45
+ ```
46
+
47
+ Errors are JSON with `error.message` / `error.code` — show them verbatim.
48
+ `401` / `OAuthException` → token expired or missing scope; a null `PAGE` → the
49
+ token isn't a Page token / manages no Page (see Gotchas). Reconnect if needed.
50
+
51
+ > If the user token path is used, `/me/accounts` also returns a per-Page
52
+ > `access_token` in `.data[0].access_token`. Prefer that Page token for the
53
+ > publish call when the injected token is a user token; a Page's own token is
54
+ > what `pages_manage_posts` actually authorizes.
55
+
56
+ ## Publish a text or link post
57
+
58
+ **Confirm the message (and link, if any) with the user first.** Post to
59
+ `/{page-id}/feed`:
60
+
61
+ ```bash
62
+ # Text-only post
63
+ curl -sS -X POST "https://graph.facebook.com/v21.0/$PAGE/feed" \
64
+ --data-urlencode "message=One endpoint → posters, cards, mockups. #AI #API" \
65
+ -d "access_token=$FACEBOOK_ACCESS_TOKEN" | jq .
66
+ # → {"id":"<PAGE_ID>_<POST_ID>"}
67
+
68
+ # Link post — Facebook renders a link preview card from the URL
69
+ curl -sS -X POST "https://graph.facebook.com/v21.0/$PAGE/feed" \
70
+ --data-urlencode "message=Read our new guide 👇" \
71
+ -d "link=https://acedata.cloud/blog/xxxx" \
72
+ -d "access_token=$FACEBOOK_ACCESS_TOKEN" | jq .
73
+ ```
74
+
75
+ ## Publish a photo post
76
+
77
+ Post to `/{page-id}/photos` with a **public image URL** (Facebook server-side
78
+ fetches it); `caption` is the post text:
79
+
80
+ ```bash
81
+ curl -sS -X POST "https://graph.facebook.com/v21.0/$PAGE/photos" \
82
+ -d "url=https://cdn.acedata.cloud/xxxx.jpg" \
83
+ --data-urlencode "caption=One endpoint → posters, cards, mockups. #AI #API" \
84
+ -d "access_token=$FACEBOOK_ACCESS_TOKEN" | jq .
85
+ # → {"id":"<PHOTO_ID>","post_id":"<PAGE_ID>_<POST_ID>"}
86
+ ```
87
+
88
+ To attach **multiple photos** to one post: upload each with `published=false` to
89
+ get its media id, then create the feed post with
90
+ `attached_media[0]={"media_fbid":"<ID1>"}` … for each.
91
+
92
+ ## Get the post permalink
93
+
94
+ Use the returned `post_id` (or `id`) to fetch the live URL to hand back:
95
+
96
+ ```bash
97
+ curl -sS "https://graph.facebook.com/v21.0/<PAGE_ID>_<POST_ID>?fields=permalink_url&access_token=$FACEBOOK_ACCESS_TOKEN" | jq -r .permalink_url
98
+ ```
99
+
100
+ ## Read recent Page posts
101
+
102
+ ```bash
103
+ curl -sS "https://graph.facebook.com/v21.0/$PAGE/posts?fields=id,message,created_time,permalink_url&limit=10&access_token=$FACEBOOK_ACCESS_TOKEN" | jq .
104
+ ```
105
+
106
+ ## Gotchas
107
+
108
+ - **Pages only, not profiles** — the Graph API cannot publish to a personal
109
+ timeline. If the user asks to post to their profile, explain this limitation.
110
+ - **Page token, not user token** — publishing needs a Page access token with
111
+ `pages_manage_posts`. If you only have a user token, resolve the Page token via
112
+ `/me/accounts` (see above). A `(#200)` permissions error means the token lacks
113
+ `pages_manage_posts` or the user isn't an admin of the Page.
114
+ - **Photo URL must be public** on a server Facebook can reach; local files won't
115
+ work. Host on cdn.acedata.cloud first.
116
+ - **Page Publishing Authorization (PPA):** some Pages must complete PPA before API
117
+ publishing works — surface the API error verbatim if it mentions PPA.
118
+ - **Token expiry:** a Page token derived from a short-lived user token expires
119
+ fast. If posting 401s soon after connecting, the user needs a long-lived Page
120
+ token — surface the `OAuthException` verbatim and suggest reconnecting.
121
+ - API version: keep the `vXX.0` path current if you hit a version/deprecation error.
122
+
123
+ ## Record the output
124
+
125
+ After you successfully publish and obtain the live permalink, call the built-in
126
+ `publish_artifact` tool ONCE so the user can track it in **My Outputs**:
127
+
128
+ ```
129
+ publish_artifact(kind="post", channel="facebook", title="<title>", url="<the REAL permalink>", status="delivered")
130
+ ```
131
+
132
+ Use the real returned URL — never fabricate one. Call it once per published item,
133
+ only after delivery is confirmed; skip it (or use `status="failed"`) if publishing failed.
134
+ See `_shared/artifacts.md`.