Skip to content

Webhook Push

Webhook Push 用于把一条消息同时推送到多个已配置目标。适合运维告警、支付通知、交易提醒、构建通知和客户工作流事件。

Endpoint

http
POST /v1/apps/webhook-push/:alias/send

所需 scope:

text
push:send

请求示例

bash
curl -X POST https://api.open4x.com/v1/apps/webhook-push/ops/send \
  -H "X-API-Key: sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Order Paid",
    "text": "订单 10001 已支付",
    "payload": {
      "order_id": "10001"
    }
  }'

响应示例

json
{
  "ok": true,
  "success_count": 2,
  "failure_count": 0,
  "results": []
}

目标配置

每个 target 可以独立启用或禁用:

json
{
  "targets": [
    {
      "id": "target_1",
      "name": "Telegram alerts",
      "platform": "telegram",
      "connected_account_id": "conn_...",
      "chat_id": "-1001234567890",
      "enabled": true
    },
    {
      "id": "target_2",
      "name": "Ops webhook",
      "platform": "generic",
      "url": "https://api.example.com/webhooks/notify",
      "enabled": true
    }
  ]
}

连接账户支持

Webhook Push 可以复用 active 状态的 Connected Accounts:

Target 类型支持的连接账户
Telegramtelegram-botcustom-api-key
Generic/custom webhookcustom-api-key

选择 Telegram 连接账户后,target 不再保存 bot token。运行时只在本次请求内解析并注入 token。

Generic target 可以选择 Bearer 认证:

json
{
  "platform": "generic",
  "connected_account_id": "conn_...",
  "auth_mode": "bearer",
  "url": "https://api.example.com/webhooks/notify"
}

计费

Webhook Push 建议按 fan-out 请求计费。一次 API 调用可以推送到多个启用目标,响应会返回成功和失败数量。