> ## 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.

# デバイスのChatwoot設定を作成または更新

> グローバルCHATWOOT_*env設定の代わりに、このデバイスのメッセージを独自のChatwoot宛先(URL+アカウント +
受信トレイ+トークン)にルーティングします。
The URL is canonicalized and validated (http/https only, no embed
credentials, hostresolding to private/loopback/link-local/metadata addresses
are rejected without CHATWOOT_ALLOWED_HOSTS).
更新時、空の `api_token` 、または GET —
からエコーされたマスク値は、保存されたトークンを保持します。 ルーティングID (url/account/inbox) の変更は
設定が会話をリンクすると409で拒否されます。削除して
再バインドする設定を再作成します。




## OpenAPI

````yaml /ja/openapi.yml put /devices/{device_id}/chatwoot/config
openapi: 3.0.0
info:
  title: WhatsApp API マルチデバイス
  version: 9.7.0
  description: |
    この API は API 経由で whatsapp を送信するために使用されます。

    Web ダッシュボードは別のプロジェクトです (gowa-ui); サーバーは
    最新のリリースアセットをダウンロードし、`/`で動作します（または、
    APP_UI_ENABLED=falseの場合はJSONバナーを返します）。

    デバイススコープ:
    - すべてのデバイススコープの REST コールで `X-Device-Id` を送信します。
    - WebSocket: `/wsに接続しますか？device_id=<id> ` 。
    - WebSocket 認証（Basic Auth が有効な場合）: ブラウザーは WebSocket 接続で
      Authorization ヘッダーを設定できないため、クエリ文字列にも
      `&authorization=<base64(user:pass)>` を渡してください。 認証情報が URL に表示されるため、本番環境では
      TLS を使用してください。
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: Whatsappサーバーへの初期接続
  - name: device
    description: マルチデバイスサポートのためのデバイス管理
  - name: user
    description: 情報の取得
  - name: send
    description: メッセージ (テキスト/イメージ/ファイル/ビデオ) を送信します。
  - name: message
    description: メッセージ操作 (revoke/react/update)
  - name: call
    description: 通話管理 (着信拒否)
  - name: chat
    description: チャットとメッセージ
  - name: group
    description: グループ設定
  - name: newsletter
    description: ニュースレターの設定
  - name: chatwoot
    description: カスタマーサポートのためのChatwoot統合
paths:
  /devices/{device_id}/chatwoot/config:
    put:
      tags:
        - chatwoot
      summary: デバイスのChatwoot設定を作成または更新
      description: >
        グローバルCHATWOOT_*env設定の代わりに、このデバイスのメッセージを独自のChatwoot宛先(URL+アカウント +

        受信トレイ+トークン)にルーティングします。

        The URL is canonicalized and validated (http/https only, no embed

        credentials, hostresolding to private/loopback/link-local/metadata
        addresses

        are rejected without CHATWOOT_ALLOWED_HOSTS).

        更新時、空の `api_token` 、または GET —

        からエコーされたマスク値は、保存されたトークンを保持します。 ルーティングID (url/account/inbox) の変更は

        設定が会話をリンクすると409で拒否されます。削除して

        再バインドする設定を再作成します。
      operationId: chatwootUpsertDeviceConfig
      parameters:
        - $ref: '#/components/parameters/ChatwootConfigDeviceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - chatwoot_url
                - account_id
                - inbox_id
              properties:
                chatwoot_url:
                  type: string
                  example: https://chatwoot.example.com
                account_id:
                  type: integer
                  example: 1
                inbox_id:
                  type: integer
                  example: 5
                api_token:
                  type: string
                  description: >-
                    Chatwoot agent/bot API トークン。 作成時に必要です。empty (またはマスクされた値)
                    は、更新時に保存されたトークンを保持します。
                webhook_secret:
                  type: string
                  description: >
                    この受信トレイの API チャンネルの Webhook シークレット。 このデバイスにルーティングされたすべての

                    Webhookを保護するように設定されている場合 (`/chatwoot/webhook/{device_id}` と


                    CHATWOOT_WEBHOOK_SECRETの代わりに、共有された`/chatwoot/webhook`) 。
                    保存されている値を保持するために省略します。空の

                    文字列を送信して削除します。 APIが返すことはありません。
                enabled:
                  type: boolean
                  default: true
      responses:
        '200':
          description: 設定を保存しました
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: SUCCESS
                  message:
                    type: string
                    example: Chatwoot device config saved
                  results:
                    $ref: '#/components/schemas/ChatwootDeviceConfig'
        '400':
          description: 無効なリクエスト (INVALID_REQUEST) または拒否された URL (INVALID_CHATWOOT_URL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '404':
          description: デバイスが見つかりません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '409':
          description: リンクされた会話が存在する間、ルーティングIDの変更が拒否されました (CONFIG_HAS_LINKED_CONVERSATIONS)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
components:
  parameters:
    ChatwootConfigDeviceId:
      name: device_id
      in: path
      required: true
      description: Chatwoot設定のデバイス ID (または WhatsApp JID)
      schema:
        type: string
        example: my-device-id
  schemas:
    ChatwootDeviceConfig:
      type: object
      description: デバイス毎のChatwootルーティング設定 (読み込みごとにAPIトークンがマスクされます)
      properties:
        device_id:
          type: string
          example: my-device-id
        device_jid:
          type: string
          description: デバイスのWhatsApp JID; ログイン時に自動的にスタンプされます (ペアリング前に空)
          example: 628123456789@s.whatsapp.net
        chatwoot_url:
          type: string
          example: https://chatwoot.example.com
        account_id:
          type: integer
          example: 1
        inbox_id:
          type: integer
          example: 5
        api_token:
          type: string
          description: 仮面; 最後の 4 文字だけが明らかになります
          example: '****1234'
        enabled:
          type: boolean
          example: true
        webhook_url:
          type: string
          description: このデバイスのChatwoot受信トレイにエージェントがこのデバイスに戻るように設定するURL
          example: https://gowa.example.com/chatwoot/webhook/my-device-id
        webhook_secret_set:
          type: boolean
          description: このデバイスに独自の webhook シークレットがあるかどうか（シークレット自体は返却されません）
          example: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    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: 追加データ
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

## Related topics

- [デバイスのChatwoot設定を削除する](https://gowa-docs.mintlify.site/ja/api-reference/chatwoot/デバイスのchatwoot設定を削除する.md)
- [デバイスのChatwoot設定を取得する](https://gowa-docs.mintlify.site/ja/api-reference/chatwoot/デバイスのchatwoot設定を取得する.md)
- [デバイス毎のChatwoot Webhookエンドポイント](https://gowa-docs.mintlify.site/ja/api-reference/chatwoot/デバイス毎のchatwoot-webhookエンドポイント.md)
- [Chatwoot統合](https://gowa-docs.mintlify.site/ja/integrations/chatwoot.md)
- [デバイスごとのChatwoot設定の一覧](https://gowa-docs.mintlify.site/ja/api-reference/chatwoot/デバイスごとのchatwoot設定の一覧.md)


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