> ## Documentation Index
> Fetch the complete documentation index at: https://gowa-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 设置设备webhook 配置

> 为特定设备设置一个自定义Webhook 配置。 当设置此设备的
Webhook 事件将被发送到这个URL，而不是全局Webhook URL。 决定级`webhook_secret`,
`webhook_events`, 和 `webhook_insecure_skip_verify` 覆盖此设备的全局webhook 设置。

设置为空字符串来清除和使用全局Webhook。




## OpenAPI

````yaml /zh/openapi.yml patch /devices/{device_id}/webhook
openapi: 3.0.0
info:
  title: WhatsApp API 多设备
  version: 9.7.0
  description: |
    此 API 用于通过 API 发送什么应用。

    Web 仪表板是一个单独的项目(gowa-ui)； 服务器下载它的
    最新版本资产并在 `/` 处服务(或在
    APP_UI_ENABLED=false时返回一个 JSON 横幅)。

    设备范围：
    - 在所有设备范围的REST 调用上发送 `X-Device-Id` 。
    - WebSocket: 连接到"/w?device_id=<id>`.
    - WebSocket 身份验证（启用基本身份验证时）：浏览器无法为
      WebSocket 连接设置 Authorization 请求头，因此还需在
      查询字符串中传入 `&authorization=<base64(user:pass)>`。 在
      生产中使用TLS ，因为凭据在 URL 中可见。
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: 初始连接到 Whatsapp 服务器
  - name: device
    description: 多设备支持的设备管理
  - name: user
    description: 获取信息
  - name: send
    description: 发送消息 (Text/Image/File/Video)。
  - name: message
    description: 消息操作 (撤销/react/update)。
  - name: call
    description: 通话管理 (拒绝来电)
  - name: chat
    description: 聊天对话和消息
  - name: group
    description: 组设置
  - name: newsletter
    description: 通讯设置
  - name: chatwoot
    description: 客户支持的聊天窗口集成
paths:
  /devices/{device_id}/webhook:
    patch:
      tags:
        - device
      summary: 设置设备webhook 配置
      description: |
        为特定设备设置一个自定义Webhook 配置。 当设置此设备的
        Webhook 事件将被发送到这个URL，而不是全局Webhook URL。 决定级`webhook_secret`,
        `webhook_events`, 和 `webhook_insecure_skip_verify` 覆盖此设备的全局webhook 设置。

        设置为空字符串来清除和使用全局Webhook。
      operationId: updateDeviceWebhook
      parameters:
        - name: device_id
          in: path
          required: true
          schema:
            type: string
          description: 设备ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                webhook_url:
                  type: string
                  description: 为此设备自定义Webhook URL。 设置为清空字符串。
                  example: https://example.com/webhook
                webhook_secret:
                  type: string
                  description: 用于签名此设备的 webhook 有效载荷的可选秘密。
                  example: super-secret-key
                webhook_events:
                  type: string
                  description: 可选的 webhook逗号分隔的事件白名单。 空意味着所有事件。
                  example: message,message.ack
                webhook_insecure_skip_verify:
                  type: boolean
                  description: 可选的。 跳过 Web 钩子的 TLS 证书验证。
                  example: false
              required:
                - webhook_url
      responses:
        '200':
          description: 好的
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                  code:
                    type: string
                    example: SUCCESS
                  message:
                    type: string
                    example: Device webhook updated
                  results:
                    type: object
                    properties:
                      device_id:
                        type: string
                        description: 设备ID
                        example: my-device
                      webhook_url:
                        type: string
                        description: 已配置的 webhook URL
                        example: https://example.com/webhook
                      webhook_secret:
                        type: string
                        description: 用于签名此设备的 webhook 有效载荷的密钥
                        example: super-secret-key
                      webhook_events:
                        type: string
                        description: 此设备的 webhook 逗号分隔事件白名单
                        example: message,message.ack
                      webhook_insecure_skip_verify:
                        type: boolean
                        description: 此设备的 Web 钩子是否跳过 TLS 验证
                        example: false
        '400':
          description: 错误请求
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '404':
          description: 找不到设备
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorNotFound'
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorInternalServer'
components:
  schemas:
    ErrorBadRequest:
      type: object
      properties:
        code:
          type: string
          example: 400
          description: HTTP 状态代码
        message:
          type: string
          example: field cannot be blank
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
    ErrorNotFound:
      type: object
      properties:
        code:
          type: string
          example: 404
          description: HTTP 状态代码
        message:
          type: string
          example: Chat not found
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
    ErrorInternalServer:
      type: object
      properties:
        code:
          type: string
          example: INTERNAL_SERVER_ERROR
          description: SYSTEM_CODE_ERROR
        message:
          type: string
          example: you are not loggin
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

## Related topics

- [获取设备webhook 配置](https://gowa-docs.mintlify.site/zh/api-reference/device/获取设备webhook-配置.md)
- [Webhooks](https://gowa-docs.mintlify.site/zh/concepts/webhooks.md)
- [配置引用](https://gowa-docs.mintlify.site/zh/configuration.md)
- [每台设备聊天woot webhook 端点](https://gowa-docs.mintlify.site/zh/api-reference/chatwoot/每台设备聊天woot-webhook-端点.md)
- [列出每台设备的Chatwoot 配置](https://gowa-docs.mintlify.site/zh/api-reference/chatwoot/列出每台设备的chatwoot-配置.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.