跳转到内容

快速开始

本指南将帮助你从 0 到 1 跑通 MessageRouter:创建 API Key、通过 API 上报事件、查看事件列表。

  1. 打开 Dashboard,使用 Google 或邮箱登录。没有账号的邮箱验证后会自动注册。

  2. 进入「设置」页面,在「API Keys」区域输入 Key 名称并点击「创建 Key」。明文只显示一次,请立即复制保存。

  3. 终端窗口
    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)
  4. 终端窗口
    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 的「收件箱」查看事件。

检查:

  • /v1/* 请求是否带 Authorization: Bearer <API_KEY>
  • API Key 是否已被吊销或删除(在「设置」页面的「API Keys」区域查看状态)
  • 微信回调验签失败时,确认 ConnectorBind 中的 token 与微信公众平台填写的 Token 一致

检查:

  • 是否有已启用且能匹配该事件的路由规则
  • 在 Dashboard「执行日志」或 GET /v1/route-logs?event_id=<event_id> 查看执行结果和错误信息