查询指定 Webhook 的事件

更新时间:
复制 MD 格式

按 event_id 倒序返回指定 Webhook 最近 7 天的投递事件,每个事件包含当前 Webhook 的 delivery 信息。没有匹配记录时返回空数组;Webhook 删除后,已有投递事件在 7 天保留期内仍可查询。

前提

已完成 Endpoint 与鉴权配置,详见API 总览与认证。

接口

GET/webhook_endpoints/{id}/events

路径参数

idstring必填

Webhook ID,格式 wep_<ULID>

查询参数

limitinteger可选

每页数量,默认 20,范围 1~100

pagestring可选

不透明分页游标;首页不传,后续传上一页返回的 next_page

请求示例

curl "$AGENTSTUDIO_URL/webhook_endpoints/wep_01JXX7YQGPRPV1BZXA35QE7WDP/events?limit=20" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"

响应字段

dataarray<object>

事件对象数组

data[].typestring

固定为 event

data[].idstring

事件 ID,格式 whe_<ULID>;同一事件的所有投递尝试使用相同外层 id

data[].created_atstring

事件创建时间,ISO 8601

data[].dataobject

事件载荷

data[].data.idstring

资源标识;Thread 事件中为 Session 标识

data[].data.typestring

事件类型

data[].data.workspace_idstring

工作空间 ID

data[].data.session_thread_idstring

Thread 事件中为具体 Thread 标识

data[].deliveryobject

当前 Webhook 的投递信息

data[].delivery.webhook_idstring

Webhook ID

data[].delivery.statusstring

投递状态,如 SUCCEEDED

data[].delivery.attempt_countinteger

投递尝试次数

data[].delivery.delivery_atstring

投递开始时间,ISO 8601

data[].delivery.finish_atstring

投递完成时间,ISO 8601

data[].delivery.failure_reasonstring | null

失败原因;成功时为 null

next_pagestring | null

下一页游标,末页为 null

request_idstring

本次请求的唯一标识,排查问题时附带

响应示例

响应包含 data(Webhook对象数组)与 next_page(下一页游标,无更多数据时为 null)。

{
  "data": [
    {
      "type": "event",
      "id": "whe_01JXX8JY9BBM4BK4C2P7K3M3ZR",
      "created_at": "2026-08-06T10:30:21.123Z",
      "data": {
        "id": "sesn_xxx",
        "type": "session.thread_idled",
        "workspace_id": "ws_xxx",
        "session_thread_id": "sthread_xxx"
      },
      "delivery": {
        "webhook_id": "wep_01JXX7YQGPRPV1BZXA35QE7WDP",
        "status": "SUCCEEDED",
        "attempt_count": 1,
        "delivery_at": "2026-08-06T10:30:21.450Z",
        "finish_at": "2026-08-06T10:30:21.780Z",
        "failure_reason": null
      }
    }
  ],
  "next_page": null,
  "request_id": "8e1d16e4"
}

错误码

状态码错误码说明
40011800016invalid webhook event query