跳到主要内容

Webhook 配置

Webhook 配置 API 允许管理 webhook 端点,以实时接收书写事件通知。每个 tenant 可以拥有多个 webhook 配置,从而将事件发送到不同的目的地。


数据模型

Webhook 配置

{
"configuration_key": "550e8400-e29b-41d4-a716-446655440000",
"tenant_key": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"url": "https://example.com/webhook",
"headers": {
"Authorization": "Bearer token",
"X-Custom-Header": "value"
},
"hmac_signature_key": "secret-key"
}

创建 Webhook 配置 (POST)

Request

ENDPOINT
/outgoing_webhook/webhook_configuration
MÉTODO
POST

Request Body

{
"tenant_key": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"url": "https://example.com/webhook",
"hmac_signature_key": "your-secret-key",
"headers": {
"Authorization": "Bearer token",
"X-Custom-Header": "value"
}
}

Request Body Params

字段类型描述
tenant_key*stringtenant 的 UUID(UUID v4)。
url*string接收 webhook 的目标 URL。
hmac_signature_key*string用于 webhook HMAC 签名的密钥。
headersobject请求中要包含的自定义 headers。

Response

STATUS
201
Response Body
{
"configuration_key": "550e8400-e29b-41d4-a716-446655440000",
"tenant_key": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"url": "https://example.com/webhook",
"headers": {
"Authorization": "Bearer token",
"X-Custom-Header": "value"
},
"hmac_signature_key": "your-secret-key"
}

Response Body Params

字段类型描述
configuration_keystringwebhook 配置的唯一键(UUID v4)。
tenant_keystringtenant 的 UUID。
urlstring已配置的目标 URL。
headersobject已配置的自定义 headers。
hmac_signature_keystringHMAC 签名的密钥。

列出 Webhook 配置 (GET)

Request

ENDPOINT
/outgoing_webhook/webhook_configuration
MÉTODO
GET

Query Params

字段类型描述
tenant_key*string用于筛选配置的 tenant UUID。
pageinteger页码(默认:1)。
page_sizeinteger每页条目数(默认:100)。

Response

STATUS
200
Response Body
{
"data": [
{
"configuration_key": "550e8400-e29b-41d4-a716-446655440000",
"tenant_key": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"url": "https://example.com/webhook",
"headers": {
"Authorization": "Bearer token"
},
"hmac_signature_key": "your-secret-key"
}
],
"pagination": {
"current_page": 1,
"page_size": 100,
"total_rows": 15,
"total_pages": 1
}
}

Response Body Params

字段类型描述
dataarraywebhook 配置列表。
paginationobjectpagination 对象

通过键获取 Webhook 配置 (GET)

Request

ENDPOINT
/outgoing_webhook/webhook_configuration/CONFIGURATION-KEY
MÉTODO
GET

Path Params

字段类型描述字符数
CONFIGURATION-KEYstringwebhook 配置的唯一键(UUID v4)。36

Response

STATUS
200
Response Body
{
"configuration_key": "550e8400-e29b-41d4-a716-446655440000",
"tenant_key": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"url": "https://example.com/webhook",
"headers": {
"Authorization": "Bearer token"
},
"hmac_signature_key": "your-secret-key"
}

Response Body Params

字段类型描述
configuration_keystringwebhook 配置的唯一键(UUID v4)。
tenant_keystringtenant 的 UUID。
urlstring已配置的目标 URL。
headersobject已配置的自定义 headers。
hmac_signature_keystringHMAC 签名的密钥。

更新 Webhook 配置 (PUT)

Request

ENDPOINT
/outgoing_webhook/webhook_configuration/CONFIGURATION-KEY
MÉTODO
PUT

Path Params

字段类型描述字符数
CONFIGURATION-KEYstringwebhook 配置的唯一键(UUID v4)。36

Request Body

{
"url": "https://new-url.com/webhook",
"headers": {
"New-Header": "new-value"
},
"hmac_signature_key": "new-secret-key"
}

Request Body Params

字段类型描述
urlstring接收 webhook 的新目标 URL。
headersobject请求中要包含的新自定义 headers。
hmac_signature_keystringwebhook HMAC 签名的新密钥。

Response

STATUS
200
Response Body
{
"configuration_key": "550e8400-e29b-41d4-a716-446655440000",
"tenant_key": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"url": "https://new-url.com/webhook",
"headers": {
"New-Header": "new-value"
},
"hmac_signature_key": "new-secret-key"
}

Response Body Params

字段类型描述
configuration_keystringwebhook 配置的唯一键(UUID v4)。
tenant_keystringtenant 的 UUID。
urlstring已配置的目标 URL。
headersobject已配置的自定义 headers。
hmac_signature_keystringHMAC 签名的密钥。

删除 Webhook 配置 (DELETE)

Request

ENDPOINT
/outgoing_webhook/webhook_configuration/CONFIGURATION-KEY
MÉTODO
DELETE

Path Params

字段类型描述字符数
CONFIGURATION-KEYstringwebhook 配置的唯一键(UUID v4)。36

Response

STATUS
200
Response Body
{}