api-config.json 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. "name": "wechat-get-messages",
  3. "displayName": "获取微信消息列表",
  4. "description": "获取微信消息列表,支持按联系人过滤和增量拉取(since),是自动应答的数据入口。",
  5. "category": "wechat",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "GET",
  9. "url": "{{wechatApiBase}}/messages",
  10. "headers": {}
  11. },
  12. "parameters": {
  13. "type": "object",
  14. "required": [],
  15. "properties": {
  16. "limit": {
  17. "type": "integer",
  18. "description": "返回条数上限,默认50,最大200",
  19. "default": 50
  20. },
  21. "wxid": {
  22. "type": "string",
  23. "description": "按联系人wxid过滤",
  24. "default": ""
  25. },
  26. "direction": {
  27. "type": "string",
  28. "description": "按方向过滤:sent或received",
  29. "enum": ["sent", "received", ""],
  30. "default": ""
  31. },
  32. "since": {
  33. "type": "string",
  34. "description": "ISO时间戳,只返回此时间之后的消息",
  35. "default": ""
  36. }
  37. }
  38. },
  39. "requestTransform": {
  40. "description": "参数拼接为query string",
  41. "queryParams": {
  42. "limit": "{{limit}}",
  43. "wxid": "{{wxid}}",
  44. "direction": "{{direction}}",
  45. "since": "{{since}}"
  46. }
  47. },
  48. "response": {
  49. "type": "object",
  50. "properties": {
  51. "ret": { "type": "integer", "description": "200表示成功" },
  52. "data": {
  53. "type": "array",
  54. "description": "消息列表(时间倒序)",
  55. "items": {
  56. "type": "object",
  57. "properties": {
  58. "id": { "type": "string" },
  59. "direction": { "type": "string" },
  60. "type": { "type": "string" },
  61. "fromWxid": { "type": "string" },
  62. "toWxid": { "type": "string" },
  63. "nickName": { "type": "string" },
  64. "content": { "type": "string" },
  65. "timestamp": { "type": "string" }
  66. }
  67. }
  68. },
  69. "total": { "type": "integer" }
  70. }
  71. },
  72. "usageExamples": [
  73. {
  74. "name": "增量拉取新消息",
  75. "input": { "since": "2026-04-11T10:00:00.000Z", "direction": "received" },
  76. "description": "获取指定时间之后收到的所有新消息"
  77. }
  78. ],
  79. "tokenConfig": {
  80. "type": "config",
  81. "configFile": "~/.openclaw/wechat-credentials.json",
  82. "tokenField": "wechatApiBase",
  83. "currentToken": "http://8.138.37.248/api/wechat-agent",
  84. "resolutionOrder": ["configFile", "currentToken"]
  85. },
  86. "timeout": 15000,
  87. "retry": { "maxAttempts": 2, "delay": 1000, "backoffMultiplier": 2 }
  88. }