api-config.json 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. {
  2. "name": "keyword-search",
  3. "displayName": "Amazon 关键词查询",
  4. "description": "查询 Amazon 关键词的搜索量、搜索趋势、竞争度等数据。用于广告关键词推荐、趋势雷达、飙升卖点词分析。",
  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. "Keyword"
  19. ],
  20. "properties": {
  21. "Keyword": {
  22. "type": "string",
  23. "description": "要查询的关键词,如 'reed diffuser'、'natural reed diffuser'、'candle warmer lamp aesthetic'"
  24. },
  25. "domain": {
  26. "type": "integer",
  27. "description": "Amazon 站点 ID: 1=amazon.com",
  28. "default": 1
  29. }
  30. }
  31. },
  32. "requestTransform": {
  33. "template": {
  34. "path": "/api/KeywordQuery",
  35. "method": "POST",
  36. "query": {
  37. "domain": "{{domain}}"
  38. },
  39. "body": {
  40. "Keyword": "{{Keyword}}"
  41. }
  42. }
  43. },
  44. "response": {
  45. "type": "object",
  46. "description": "关键词查询结果",
  47. "properties": {
  48. "SearchVolume": {
  49. "type": "integer",
  50. "description": "月搜索量"
  51. },
  52. "SearchVolumeGrowth": {
  53. "type": "number",
  54. "description": "搜索量增长率 (%)"
  55. },
  56. "CompetitionLevel": {
  57. "type": "string",
  58. "description": "竞争度: 低/中/高/极高"
  59. },
  60. "CPC": {
  61. "type": "number",
  62. "description": "建议广告出价 (美元)"
  63. },
  64. "ConversionRate": {
  65. "type": "number",
  66. "description": "转化率 (%)"
  67. },
  68. "RelatedKeywords": {
  69. "type": "array",
  70. "description": "相关关键词列表"
  71. }
  72. }
  73. },
  74. "usageExamples": [
  75. {
  76. "name": "查询关键词搜索量",
  77. "input": {
  78. "Keyword": "natural reed diffuser",
  79. "domain": 1
  80. },
  81. "description": "查询 'natural reed diffuser' 在美国站的搜索量和竞争度"
  82. }
  83. ],
  84. "reportMapping": {
  85. "slides": [
  86. "趋势雷达(Slide12)",
  87. "广告关键词引擎(Slide15)"
  88. ],
  89. "dataPoints": [
  90. "关键词搜索量",
  91. "增长率",
  92. "竞争度",
  93. "建议出价",
  94. "VOC匹配度"
  95. ]
  96. },
  97. "timeout": 60000,
  98. "retry": {
  99. "maxAttempts": 3,
  100. "delay": 1000,
  101. "backoffMultiplier": 2
  102. },
  103. "tokenConfig": {
  104. "type": "bearer",
  105. "configFile": "~/.openclaw/voc-credentials.json",
  106. "tokenField": "vocToken",
  107. "resolutionOrder": [
  108. "configFile"
  109. ],
  110. "apigId": "7HwdQZk55B",
  111. "paymentUrlResolution": {
  112. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  113. "steps": [
  114. "1. 从 voc-credentials.json 获取当前 session token",
  115. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  116. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  117. "4. 将该URL展示给用户,引导扫码支付"
  118. ],
  119. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  120. "userResolveHeaders": {
  121. "X-Parse-Application-Id": "ncloudmaster",
  122. "X-Parse-Session-Token": "{vocToken}"
  123. },
  124. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  125. "paymentParams": {
  126. "user": "{resolvedUserId}",
  127. "apigid": "7HwdQZk55B",
  128. "fun_id": "HOkkX72PMF"
  129. },
  130. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  131. },
  132. "onMissing": {
  133. "action": "showPaymentQR",
  134. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  135. "title": "扫码开通 VOC-AI 数据服务",
  136. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  137. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  138. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  139. },
  140. "onBalanceInsufficient": {
  141. "action": "resolveUserThenShowPayment",
  142. "title": "VOC-AI Token 余额不足,请扫码充值",
  143. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  144. }
  145. },
  146. "errorHandling": {
  147. "balanceInsufficient": {
  148. "conditions": [
  149. {
  150. "responseField": "code",
  151. "operator": "in",
  152. "value": [
  153. -2,
  154. -3,
  155. -10,
  156. 402,
  157. 429
  158. ]
  159. },
  160. {
  161. "responseField": "msg",
  162. "operator": "contains",
  163. "value": [
  164. "余额不足",
  165. "insufficient",
  166. "balance",
  167. "quota",
  168. "没有开通",
  169. "权限或余额"
  170. ]
  171. },
  172. {
  173. "responseField": "mess",
  174. "operator": "contains",
  175. "value": [
  176. "余额不足",
  177. "insufficient",
  178. "balance",
  179. "quota",
  180. "没有开通",
  181. "权限或余额"
  182. ]
  183. },
  184. {
  185. "responseField": "message",
  186. "operator": "contains",
  187. "value": [
  188. "余额不足",
  189. "insufficient",
  190. "balance",
  191. "没有开通",
  192. "权限或余额"
  193. ]
  194. }
  195. ],
  196. "matchMode": "any",
  197. "trigger": "tokenConfig.onBalanceInsufficient"
  198. },
  199. "unauthorized": {
  200. "conditions": [
  201. {
  202. "responseField": "code",
  203. "operator": "in",
  204. "value": [
  205. 401,
  206. 403
  207. ]
  208. },
  209. {
  210. "responseField": "msg",
  211. "operator": "contains",
  212. "value": [
  213. "unauthorized",
  214. "token",
  215. "invalid",
  216. "auth"
  217. ]
  218. }
  219. ],
  220. "matchMode": "any",
  221. "trigger": "tokenConfig.onMissing"
  222. }
  223. }
  224. }