Skip to content

Webhook 详细说明

本文档详细介绍 Webhook 的请求格式和使用方法。

Webhook 配置

在管理 Webhook 页面中,您可以配置 Webhook 的 URL,选择需要触发的事件,并设置事件触发的条件和处理逻辑。

  1. 在表格设置页面点击"Webhooks"按钮
  2. 点击"创建 Webhook"按钮
  3. 在弹出的表单中,填写 Webhook 的名称和端点 URL,选择需要触发的方法和事件类型
  4. 点击"提交"按钮完成配置

Webhook 配置

事件格式详解

创建记录事件

当新记录被创建时自动触发:

事件名称: record.create

json
{
  "type": "record.create",
  "created_at": "2024-12-09T20:32:45.534Z",
  "data": {
    "base_id": "base123",
    "table_name": "contacts",
    "records": [
      {
        "id": "11",
        "name": "测试记录",
        "created_by": "usrIL1t20OwVvW9jXzT",
        "updated_by": "usrIL1t20OwVvW9jXzT",
        "created_at": "2024-11-20T17:30:12.000Z",
        "updated_at": "2024-11-20T17:30:27.000Z"
      }
    ]
  }
}

更新记录事件

当记录被更新时自动触发:

事件名称: record.update

json
{
  "type": "record.update",
  "created_at": "2024-12-09T20:32:45.534Z",
  "data": {
    "base_id": "base123",
    "table_name": "contacts",
    "records": [
      {
        "id": "11",
        "name": "更新后的名称",
        "created_by": "usrIL1t20OwVvW9jXzT",
        "updated_by": "usrIL1t20OwVvW9jXzT",
        "created_at": "2024-11-20T17:30:12.000Z",
        "updated_at": "2024-11-20T17:35:27.000Z"
      }
    ]
  }
}

删除记录事件

当记录被删除时自动触发:

事件名称: record.delete

json
{
  "type": "record.delete",
  "created_at": "2024-12-09T20:32:45.534Z",
  "data": {
    "base_id": "base123",
    "table_name": "contacts",
    "records": [
      {
        "id": "11",
        "deleted_at": "2024-11-20T17:40:27.000Z"
      }
    ]
  }
}

单行记录触发事件

通过单独操作触发:

事件名称: record.action

单行记录触发事件

json
{
  "type": "record.action",
  "created_at": "2024-12-09T20:32:45.534Z",
  "data": {
    "base_id": "base123",
    "table_name": "contacts",
    "records": [
      {
        "id": "11",
        "name": "测试记录",
        "created_by": "usrIL1t20OwVvW9jXzT",
        "updated_by": "usrIL1t20OwVvW9jXzT",
        "created_at": "2024-11-20T17:30:12.000Z",
        "updated_at": "2024-11-20T17:30:27.000Z"
      }
    ]
  }
}

批量操作事件

通过批量操作触发:

事件名称: record.bulk-action

批量操作事件

json
{
  "type": "record.bulk-action",
  "created_at": "2024-12-09T20:32:45.534Z",
  "data": {
    "base_id": "base123",
    "table_name": "contacts",
    "records": [
      {
        "id": "11",
        "name": "测试记录",
        "created_by": "usrIL1t20OwVvW9jXzT",
        "updated_by": "usrIL1t20OwVvW9jXzT",
        "created_at": "2024-11-20T17:30:12.000Z",
        "updated_at": "2024-11-20T17:30:27.000Z"
      }
    ]
  }
}

Released under the MIT License.