api-config.json 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. {
  2. "name": "product-reviews-query",
  3. "displayName": "Amazon 产品评论查询",
  4. "description": "根据 ASIN 抓取 Amazon 产品用户评论,支持按星级、日期、是否验证购买筛选。用于 VOC 用户洞察、痛点提取、喜爱点分析、使用场景挖掘。",
  5. "category": "voc",
  6. "version": "1.3.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/voc-ecom/forward",
  10. "headers": {
  11. "Content-Type": "application/json",
  12. "Authorization": "Bearer {{vocToken}}"
  13. }
  14. },
  15. "parameters": {
  16. "type": "object",
  17. "required": [
  18. "ASIN"
  19. ],
  20. "properties": {
  21. "ASIN": {
  22. "type": "string",
  23. "description": "Amazon 产品 ASIN(10位大写字母数字)",
  24. "pattern": "^[A-Z0-9]{10}$"
  25. },
  26. "Star": {
  27. "type": "string",
  28. "description": "筛选星级: 空=全部, '1'=1星, '2'=2星, '3'=3星, '4'=4星, '5'=5星",
  29. "default": "",
  30. "enum": [
  31. "",
  32. "1",
  33. "2",
  34. "3",
  35. "4",
  36. "5"
  37. ]
  38. },
  39. "PageIndex": {
  40. "type": "integer",
  41. "description": "分页页码,从 1 开始",
  42. "default": 1
  43. },
  44. "OnlyPurchase": {
  45. "type": "integer",
  46. "description": "仅显示验证购买评论: 0=全部, 1=仅验证购买",
  47. "default": 0,
  48. "enum": [
  49. 0,
  50. 1
  51. ]
  52. },
  53. "QueryStartDt": {
  54. "type": "string",
  55. "description": "评论起始日期,格式 YYYYMMDD,如 '20250101'",
  56. "default": ""
  57. },
  58. "domain": {
  59. "type": "integer",
  60. "description": "Amazon 站点 ID: 1=amazon.com",
  61. "default": 1
  62. }
  63. }
  64. },
  65. "requestTransform": {
  66. "template": {
  67. "path": "/api/ProductReviewsQuery",
  68. "method": "POST",
  69. "query": {
  70. "domain": "{{domain}}"
  71. },
  72. "body": {
  73. "ASIN": "{{ASIN}}",
  74. "Star": "{{Star}}",
  75. "PageIndex": "{{PageIndex}}",
  76. "OnlyPurchase": "{{OnlyPurchase}}",
  77. "QueryStartDt": "{{QueryStartDt}}"
  78. }
  79. }
  80. },
  81. "response": {
  82. "type": "object",
  83. "description": "评论查询结果",
  84. "properties": {
  85. "TotalCount": {
  86. "type": "integer",
  87. "description": "评论总数"
  88. },
  89. "Reviews": {
  90. "type": "array",
  91. "description": "评论列表",
  92. "items": {
  93. "type": "object",
  94. "properties": {
  95. "Star": {
  96. "type": "integer",
  97. "description": "评论星级 (1-5)"
  98. },
  99. "Title": {
  100. "type": "string",
  101. "description": "评论标题"
  102. },
  103. "Content": {
  104. "type": "string",
  105. "description": "评论正文"
  106. },
  107. "ConsumerName": {
  108. "type": "string",
  109. "description": "评论者名称"
  110. },
  111. "ReviewsDate": {
  112. "type": "string",
  113. "description": "评论日期,格式 '20260204'"
  114. },
  115. "ReviewedCountry": {
  116. "type": "string",
  117. "description": "评论者国家,如 'United States'"
  118. },
  119. "IsVP": {
  120. "type": "boolean",
  121. "description": "是否验证购买"
  122. },
  123. "Helpful": {
  124. "type": "integer",
  125. "description": "有用数"
  126. },
  127. "Asin": {
  128. "type": "string",
  129. "description": "关联产品 ASIN"
  130. },
  131. "AsinProperty": {
  132. "type": "string",
  133. "description": "变体属性"
  134. },
  135. "Resource": {
  136. "type": "array",
  137. "description": "评论附图 URL"
  138. },
  139. "Videos": {
  140. "type": "array",
  141. "description": "评论视频 URL"
  142. },
  143. "ConsumerURL": {
  144. "type": "string",
  145. "description": "评论者主页链接"
  146. },
  147. "ReviewsLink": {
  148. "type": "string",
  149. "description": "评论详情链接"
  150. },
  151. "ConsumerBadge": {
  152. "type": "string",
  153. "description": "评论者徽章"
  154. },
  155. "UpdateTime": {
  156. "type": "string",
  157. "description": "数据更新时间,格式 '2026-02-06 17:39'"
  158. }
  159. }
  160. }
  161. }
  162. }
  163. },
  164. "notes": "注意字段名使用 PascalCase: ReviewsDate(非 ReviewDate)、ReviewedCountry(非 ReviewsCountry)、IsVP(非 Ivp)、ConsumerURL(非 ConsumerUrl)、ReviewsLink(非 ReviewLink)。每页约返回 10 条评论,需多次分页获取完整评论。建议搭配 AI 分析进行情感分类和痛点提取。",
  165. "usageExamples": [
  166. {
  167. "name": "获取全部评论(第一页)",
  168. "input": {
  169. "ASIN": "B0B24QJ217",
  170. "domain": 1
  171. },
  172. "description": "获取 COCORRINA Reed Diffuser 的全部评论第一页"
  173. },
  174. {
  175. "name": "获取差评(1-2星)",
  176. "input": {
  177. "ASIN": "B0B24QJ217",
  178. "Star": "1",
  179. "PageIndex": 1,
  180. "domain": 1
  181. },
  182. "description": "仅获取1星差评,用于痛点分析"
  183. },
  184. {
  185. "name": "获取近期验证购买评论",
  186. "input": {
  187. "ASIN": "B0B24QJ217",
  188. "OnlyPurchase": 1,
  189. "QueryStartDt": "20250101",
  190. "domain": 1
  191. },
  192. "description": "获取2025年以来的验证购买评论"
  193. }
  194. ],
  195. "reportMapping": {
  196. "slides": [
  197. "VOC用户洞察(Slide5)",
  198. "AI深度洞察(Slide13)"
  199. ],
  200. "dataPoints": [
  201. "评论总量",
  202. "好评率",
  203. "差评率",
  204. "痛点标签及占比",
  205. "喜爱点标签及占比",
  206. "使用场景分布"
  207. ]
  208. },
  209. "timeout": 60000,
  210. "retry": {
  211. "maxAttempts": 3,
  212. "delay": 1000,
  213. "backoffMultiplier": 2
  214. },
  215. "tokenConfig": {
  216. "type": "bearer",
  217. "configFile": "~/.openclaw/voc-credentials.json",
  218. "tokenField": "vocToken",
  219. "resolutionOrder": [
  220. "configFile"
  221. ],
  222. "apigId": "7HwdQZk55B",
  223. "paymentUrlResolution": {
  224. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  225. "steps": [
  226. "1. 从 voc-credentials.json 获取当前 session token",
  227. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  228. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  229. "4. 将该URL展示给用户,引导扫码支付"
  230. ],
  231. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  232. "userResolveHeaders": {
  233. "X-Parse-Application-Id": "ncloudmaster",
  234. "X-Parse-Session-Token": "{vocToken}"
  235. },
  236. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  237. "paymentParams": {
  238. "user": "{resolvedUserId}",
  239. "apigid": "7HwdQZk55B",
  240. "fun_id": "HOkkX72PMF"
  241. },
  242. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  243. },
  244. "onMissing": {
  245. "action": "showPaymentQR",
  246. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  247. "title": "扫码开通 VOC-AI 数据服务",
  248. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  249. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  250. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  251. },
  252. "onBalanceInsufficient": {
  253. "action": "resolveUserThenShowPayment",
  254. "title": "VOC-AI Token 余额不足,请扫码充值",
  255. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  256. }
  257. },
  258. "errorHandling": {
  259. "balanceInsufficient": {
  260. "conditions": [
  261. {
  262. "responseField": "code",
  263. "operator": "in",
  264. "value": [
  265. -2,
  266. -3,
  267. -10,
  268. 402,
  269. 429
  270. ]
  271. },
  272. {
  273. "responseField": "msg",
  274. "operator": "contains",
  275. "value": [
  276. "余额不足",
  277. "insufficient",
  278. "balance",
  279. "quota",
  280. "没有开通",
  281. "权限或余额"
  282. ]
  283. },
  284. {
  285. "responseField": "mess",
  286. "operator": "contains",
  287. "value": [
  288. "余额不足",
  289. "insufficient",
  290. "balance",
  291. "quota",
  292. "没有开通",
  293. "权限或余额"
  294. ]
  295. },
  296. {
  297. "responseField": "message",
  298. "operator": "contains",
  299. "value": [
  300. "余额不足",
  301. "insufficient",
  302. "balance",
  303. "没有开通",
  304. "权限或余额"
  305. ]
  306. }
  307. ],
  308. "matchMode": "any",
  309. "trigger": "tokenConfig.onBalanceInsufficient"
  310. },
  311. "unauthorized": {
  312. "conditions": [
  313. {
  314. "responseField": "code",
  315. "operator": "in",
  316. "value": [
  317. 401,
  318. 403
  319. ]
  320. },
  321. {
  322. "responseField": "msg",
  323. "operator": "contains",
  324. "value": [
  325. "unauthorized",
  326. "token",
  327. "invalid",
  328. "auth"
  329. ]
  330. }
  331. ],
  332. "matchMode": "any",
  333. "trigger": "tokenConfig.onMissing"
  334. }
  335. }
  336. }