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_configurationMÉTODO
POSTRequest 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* | string | tenant 的 UUID(UUID v4)。 |
url* | string | 接收 webhook 的目标 URL。 |
hmac_signature_key* | string | 用于 webhook HMAC 签名的密钥。 |
headers | object | 请求中要包含的自定义 headers。 |
Response
STATUS
201Response 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_key | string | webhook 配置的唯一键(UUID v4)。 |
tenant_key | string | tenant 的 UUID。 |
url | string | 已配置的目标 URL。 |
headers | object | 已配置的自定义 headers。 |
hmac_signature_key | string | HMAC 签名的密钥。 |
列出 Webhook 配置 (GET)
Request
ENDPOINT
/outgoing_webhook/webhook_configurationMÉTODO
GETQuery Params
| 字段 | 类型 | 描述 |
|---|---|---|
tenant_key* | string | 用于筛选配置的 tenant UUID。 |
page | integer | 页码(默认:1)。 |
page_size | integer | 每页条目数(默认:100)。 |
Response
STATUS
200Response 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
| 字段 | 类型 | 描述 |
|---|---|---|
data | array | webhook 配置列表。 |
pagination | object | pagination 对象。 |
通过键获取 Webhook 配置 (GET)
Request
ENDPOINT
/outgoing_webhook/webhook_configuration/CONFIGURATION-KEYMÉTODO
GETPath Params
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
CONFIGURATION-KEY | string | webhook 配置的唯一键(UUID v4)。 | 36 |
Response
STATUS
200Response 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_key | string | webhook 配置的唯一键(UUID v4)。 |
tenant_key | string | tenant 的 UUID。 |
url | string | 已配置的目标 URL。 |
headers | object | 已配置的自定义 headers。 |
hmac_signature_key | string | HMAC 签名的密钥。 |
更新 Webhook 配置 (PUT)
Request
ENDPOINT
/outgoing_webhook/webhook_configuration/CONFIGURATION-KEYMÉTODO
PUTPath Params
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
CONFIGURATION-KEY | string | webhook 配置的唯一键(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
| 字段 | 类型 | 描述 |
|---|---|---|
url | string | 接收 webhook 的新目标 URL。 |
headers | object | 请求中要包含的新自定义 headers。 |
hmac_signature_key | string | webhook HMAC 签名的新密钥。 |
Response
STATUS
200Response 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_key | string | webhook 配置的唯一键(UUID v4)。 |
tenant_key | string | tenant 的 UUID。 |
url | string | 已配置的目标 URL。 |
headers | object | 已配置的自定义 headers。 |
hmac_signature_key | string | HMAC 签名的密钥。 |
删除 Webhook 配置 (DELETE)
Request
ENDPOINT
/outgoing_webhook/webhook_configuration/CONFIGURATION-KEYMÉTODO
DELETEPath Params
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
CONFIGURATION-KEY | string | webhook 配置的唯一键(UUID v4)。 | 36 |
Response
STATUS
200Response Body
{}