查询 Webhook 事件推送设置

查询 Webhook 事件推送设置,包括 Webhook URL、密钥、请求方式等。

请求 URL

GET {base_url}/{api_path}/webhook/query?access_token={access_token}

请求参数

无请求参数。直接发送请求 URL 查询 Webhook 事件推送设置。

响应参数

参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
data Object<Webhook_Setting> Webhook 事件推送的设置。
Webhook_Setting
参数 类型 说明
enb_webhook_event_push Integer 是否启用了 Webhook 事件推送。
  • 0:禁用
  • 1:启用
webhook_event_push_list Array<Webhook_Entry> Webhook 配置列表。
webhook_event_push_timeout Integer

等待第三方应用的 HTTP 响应的最长时间。

webhook_event_push_retry_count Integer 在推送失败或未收到成功响应时,PBX 可重新发送请求的次数。
webhook_event_ids Array<Integer> 支持监控并通过 Webhook 发送通知的 API 事件 ID 列表。

有关 API 事件的更多信息,请参见 事件报告

Webhook_Entry
参数 类型 说明
url String Webhook URL。
secret String 密钥。

此密钥用于为 Webhook 消息生成 HMAC-SHA256 签名。

消息接收者可使用此密钥验证消息的真实性和完整性。

request_method String

向 Webhook URL 发送请求的 HTTP 请求方法。

event_ids Array<Integer> 已订阅 API 事件的 ID 列表。

有关 API 事件的更多信息,请参见 事件报告

注: 若返回 0,表示所有支持的 API 事件都被监控,对应事件发生时将发送通知到 Webhook URL。

示例

请求示例

GET /openapi/v1.0/webhook/query?access_token=9lpNw53mp6Wpubgy5h4oSAHauz0K83q9 HTTP/1.1
Host: 192.168.5.150:8088

响应示例

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "data": {
        "enb_webhook_event_push": 1,
        "webhook_event_push_list": [
            {
                "url": "https://webhook.site/38e9dea1-be68-4381-8a8c-f0623517f513",
                "secret": "Pugghh14VCb05rtG7WGumbD4hwJPIvzu",
                "request_method": "POST",
                "event_ids": [
                    30022,
                    30023
                ]
            }
        ],
        "webhook_event_push_timeout": 5,
        "webhook_event_push_retry_count": 3,
        "webhook_event_ids": [
            30005,
            30006,
            30007,
            30008,
            30009,
            30010,
            30011,
            30012,
            30013,
            30014,
            30015,
            30016,
            30017,
            30018,
            30019,
            30020,
            30022,
            30023,
            30024,
            30025,
            30026,
            30027,
            30028,
            30029,
            30030,
            30031,
            30032,
            30033
        ]
    }
}