快速开始
本指南将帮助你从 0 到 1 跑通 MessageRouter:创建 API Key、通过 API 上报事件、查看事件列表。
-
登录 Dashboard
Section titled “登录 Dashboard”打开 Dashboard,使用 Google 或邮箱登录。没有账号的邮箱验证后会自动注册。
-
创建 API Key
Section titled “创建 API Key”进入「设置」页面,在「API Keys」区域输入 Key 名称并点击「创建 Key」。明文只显示一次,请立即复制保存。
-
上报第一个事件
Section titled “上报第一个事件”终端窗口 curl -X POST "https://api.messagerouter.dev/v1/events" \-H "Content-Type: application/json" \-H "Authorization: Bearer <API_KEY>" \-d '{"source_event_id": "ext-001","type": "message.link","actor": { "source_user_id": "u001", "display_name": "demo" },"payload": {"text": "推荐阅读 https://example.com/article/1","url": "https://example.com/article/1","title": "Example Article"}}'预期:
- 首次上报:
created: true(HTTP 201) - 重复上报:
created: false(HTTP 200)
- 首次上报:
-
终端窗口 curl "https://api.messagerouter.dev/v1/events?limit=20" \-H "Authorization: Bearer <API_KEY>"支持参数:
source- 过滤来源渠道type- 过滤事件类型limit- 返回条数cursor- 分页游标
终端窗口 curl "https://api.messagerouter.dev/v1/events/<event_id>" \-H "Authorization: Bearer <API_KEY>"也可以在 Dashboard 的「收件箱」查看事件。
返回 401
Section titled “返回 401”检查:
/v1/*请求是否带Authorization: Bearer <API_KEY>- API Key 是否已被吊销或删除(在「设置」页面的「API Keys」区域查看状态)
- 微信回调验签失败时,确认 ConnectorBind 中的
token与微信公众平台填写的 Token 一致
事件入库了但没看到处理结果
Section titled “事件入库了但没看到处理结果”检查:
- 是否有已启用且能匹配该事件的路由规则
- 在 Dashboard「执行日志」或
GET /v1/route-logs?event_id=<event_id>查看执行结果和错误信息