api-config.json 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. {
  2. "name": "instagram-user-posts",
  3. "displayName": "Instagram 用户帖子列表",
  4. "description": "获取指定 Instagram 用户发布的帖子列表,包括点赞数、评论数、帖子文案等。适用于竞品品牌 IG 内容策略分析、KOL 帖子互动表现评估、品牌运营频率分析。",
  5. "category": "social-media",
  6. "version": "1.3.0",
  7. "endpoint": {
  8. "method": "GET",
  9. "url": "https://server.fmode.cn/api/voc-social/instagram/v1/fetch_user_posts_v2",
  10. "headers": {
  11. "Authorization": "Bearer ${vocToken}",
  12. "Accept": "application/json"
  13. }
  14. },
  15. "parameters": {
  16. "type": "object",
  17. "required": [
  18. "user_id"
  19. ],
  20. "properties": {
  21. "user_id": {
  22. "type": "string",
  23. "description": "Instagram 用户数字 ID(pk),需先通过 instagram_user_info 或 instagram_search 接口获取"
  24. },
  25. "count": {
  26. "type": "integer",
  27. "description": "每页帖子数量",
  28. "default": 12,
  29. "maximum": 50
  30. },
  31. "end_cursor": {
  32. "type": "string",
  33. "description": "分页游标,首次不传,后续传上次返回的 end_cursor"
  34. }
  35. }
  36. },
  37. "requestTransform": {
  38. "queryParams": {
  39. "user_id": "{{user_id}}",
  40. "count": "{{count}}",
  41. "end_cursor": "{{end_cursor}}"
  42. }
  43. },
  44. "response": {
  45. "type": "object",
  46. "description": "帖子列表",
  47. "properties": {
  48. "items": {
  49. "type": "array",
  50. "description": "帖子数组",
  51. "items": {
  52. "type": "object",
  53. "properties": {
  54. "id": {
  55. "type": "string",
  56. "description": "帖子 ID"
  57. },
  58. "code": {
  59. "type": "string",
  60. "description": "帖子短码(URL 用)"
  61. },
  62. "caption": {
  63. "type": "object",
  64. "properties": {
  65. "text": {
  66. "type": "string",
  67. "description": "帖子文案"
  68. }
  69. }
  70. },
  71. "like_count": {
  72. "type": "integer",
  73. "description": "点赞数"
  74. },
  75. "comment_count": {
  76. "type": "integer",
  77. "description": "评论数"
  78. },
  79. "taken_at": {
  80. "type": "integer",
  81. "description": "发布时间戳"
  82. },
  83. "media_type": {
  84. "type": "integer",
  85. "description": "媒体类型: 1=图片, 2=视频, 8=轮播"
  86. },
  87. "image_versions2": {
  88. "type": "object",
  89. "description": "图片版本列表"
  90. },
  91. "video_versions": {
  92. "type": "array",
  93. "description": "视频版本列表(仅视频帖子)"
  94. },
  95. "view_count": {
  96. "type": "integer",
  97. "description": "视频观看次数(仅视频帖子)"
  98. }
  99. }
  100. }
  101. },
  102. "has_more": {
  103. "type": "boolean",
  104. "description": "是否有更多帖子"
  105. },
  106. "end_cursor": {
  107. "type": "string",
  108. "description": "下一页游标"
  109. }
  110. }
  111. },
  112. "notes": "user_id 需先通过 instagram-user-info 接口获取 pk 字段。互动率公式:(like_count + comment_count) / follower_count。",
  113. "relatedSkills": [
  114. "instagram-user-info",
  115. "instagram-search"
  116. ],
  117. "usageExamples": [
  118. {
  119. "name": "竞品品牌 IG 内容策略分析",
  120. "input": {
  121. "user_id": "12345678",
  122. "count": 12
  123. },
  124. "description": "获取竞品品牌最近 12 条帖子,分析发帖频率、内容主题、帖子互动率"
  125. },
  126. {
  127. "name": "KOL 帖子评估",
  128. "input": {
  129. "user_id": "达人 pk",
  130. "count": 20
  131. },
  132. "description": "获取达人近期 20 条帖子,计算帖子平均互动率(点赞+评论)/粉丝数"
  133. }
  134. ],
  135. "workflow": {
  136. "description": "推荐调用链",
  137. "steps": [
  138. "上游: instagram-search(query, select='users') → 搜索品牌/KOL → 取 username",
  139. "上游: instagram-user-info(username) → 获取 pk 字段和粉丝数",
  140. "本步: instagram-user-posts(user_id=pk) → 获取帖子列表",
  141. "分析: 计算互动率 = (like_count+comment_count)/follower_count"
  142. ]
  143. },
  144. "reportMapping": {
  145. "slides": [
  146. "竞品对标(Slide4)",
  147. "社媒聆听(Slide14)"
  148. ],
  149. "dataPoints": [
  150. "帖子平均互动率对比",
  151. "品牌发帖频率和内容规律",
  152. "内容类型分布(1=图片 2=视频 8=轮播)",
  153. "品牌视觉风格分析"
  154. ]
  155. },
  156. "timeout": 60000,
  157. "retry": {
  158. "maxAttempts": 3,
  159. "delay": 1500,
  160. "backoffMultiplier": 2
  161. },
  162. "tokenConfig": {
  163. "type": "bearer",
  164. "configFile": "~/.openclaw/voc-credentials.json",
  165. "tokenField": "vocToken",
  166. "resolutionOrder": [
  167. "configFile"
  168. ],
  169. "apigId": "Vo3ROWEvDy",
  170. "paymentUrlResolution": {
  171. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  172. "steps": [
  173. "1. 从 voc-credentials.json 获取当前 session token",
  174. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  175. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  176. "4. 将该URL展示给用户,引导扫码支付"
  177. ],
  178. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  179. "userResolveHeaders": {
  180. "X-Parse-Application-Id": "ncloudmaster",
  181. "X-Parse-Session-Token": "{vocToken}"
  182. },
  183. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  184. "paymentParams": {
  185. "user": "{resolvedUserId}",
  186. "apigid": "Vo3ROWEvDy",
  187. "fun_id": "HOkkX72PMF"
  188. },
  189. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  190. },
  191. "onMissing": {
  192. "action": "showPaymentQR",
  193. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  194. "title": "扫码开通 VOC-AI 数据服务",
  195. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  196. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  197. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  198. },
  199. "onBalanceInsufficient": {
  200. "action": "resolveUserThenShowPayment",
  201. "title": "VOC-AI Token 余额不足,请扫码充值",
  202. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  203. }
  204. },
  205. "errorHandling": {
  206. "balanceInsufficient": {
  207. "conditions": [
  208. {
  209. "responseField": "code",
  210. "operator": "in",
  211. "value": [
  212. -2,
  213. -3,
  214. -10,
  215. 402,
  216. 429
  217. ]
  218. },
  219. {
  220. "responseField": "msg",
  221. "operator": "contains",
  222. "value": [
  223. "余额不足",
  224. "insufficient",
  225. "balance",
  226. "quota",
  227. "没有开通",
  228. "权限或余额"
  229. ]
  230. },
  231. {
  232. "responseField": "mess",
  233. "operator": "contains",
  234. "value": [
  235. "余额不足",
  236. "insufficient",
  237. "balance",
  238. "quota",
  239. "没有开通",
  240. "权限或余额"
  241. ]
  242. },
  243. {
  244. "responseField": "message",
  245. "operator": "contains",
  246. "value": [
  247. "余额不足",
  248. "insufficient",
  249. "balance",
  250. "没有开通",
  251. "权限或余额"
  252. ]
  253. }
  254. ],
  255. "matchMode": "any",
  256. "trigger": "tokenConfig.onBalanceInsufficient"
  257. },
  258. "unauthorized": {
  259. "conditions": [
  260. {
  261. "responseField": "code",
  262. "operator": "in",
  263. "value": [
  264. 401,
  265. 403
  266. ]
  267. },
  268. {
  269. "responseField": "msg",
  270. "operator": "contains",
  271. "value": [
  272. "unauthorized",
  273. "token",
  274. "invalid",
  275. "auth"
  276. ]
  277. }
  278. ],
  279. "matchMode": "any",
  280. "trigger": "tokenConfig.onMissing"
  281. }
  282. }
  283. }