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

# Buat atau perbarui konfigurasi Chatwoot perangkat

> Merutekan pesan perangkat ini ke tujuan Chatwoot tersendiri (URL + akun +
inbox + token) sebagai pengganti konfigurasi env global CHATWOOT_*.
URL dikanonisasi dan divalidasi (hanya http/https, tanpa kredensial
tersemat, host yang mengarah ke alamat privat/loopback/link-local/metadata
ditolak kecuali diizinkan melalui CHATWOOT_ALLOWED_HOSTS).
Saat memperbarui, `api_token` kosong — atau nilai tersamarkan yang dikirim kembali dari GET —
mempertahankan token yang tersimpan. Perubahan identitas perutean (url/account/inbox)
ditolak dengan 409 setelah konfigurasi memiliki percakapan tertaut; hapus dan
buat ulang konfigurasi untuk mengikatnya kembali.




## OpenAPI

````yaml /id/openapi.yml put /devices/{device_id}/chatwoot/config
openapi: 3.0.0
info:
  title: WhatsApp API MultiDevice
  version: 9.7.0
  description: >
    API ini digunakan untuk mengirim pesan WhatsApp melalui API.


    Dashboard web merupakan proyek terpisah (gowa-ui); server mengunduh aset
    rilis

    terbarunya dan menyajikannya di `/` (atau mengembalikan banner JSON saat

    APP_UI_ENABLED=false).


    Cakupan perangkat:

    - Kirim `X-Device-Id` pada semua panggilan REST yang memiliki cakupan
    perangkat.

    - WebSocket: hubungkan ke `/ws?device_id=<id>`.

    - Autentikasi WebSocket (saat autentikasi dasar diaktifkan): browser tidak
    dapat menyetel
      header Authorization pada koneksi WebSocket, sehingga sertakan juga
      `&authorization=<base64(user:pass)>` dalam query string. Gunakan TLS di
      produksi karena kredensial terlihat di URL.
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: Koneksi awal ke server WhatsApp
  - name: device
    description: Pengelolaan perangkat untuk dukungan multi-perangkat
  - name: user
    description: Mengambil informasi
  - name: send
    description: Kirim pesan (teks/gambar/berkas/video).
  - name: message
    description: Manipulasi pesan (cabut/beri reaksi/perbarui).
  - name: call
    description: Pengelolaan panggilan (tolak panggilan masuk)
  - name: chat
    description: Percakapan chat dan perpesanan
  - name: group
    description: Pengaturan grup
  - name: newsletter
    description: Pengaturan newsletter
  - name: chatwoot
    description: Integrasi Chatwoot untuk dukungan pelanggan
paths:
  /devices/{device_id}/chatwoot/config:
    put:
      tags:
        - chatwoot
      summary: Buat atau perbarui konfigurasi Chatwoot perangkat
      description: >
        Merutekan pesan perangkat ini ke tujuan Chatwoot tersendiri (URL + akun
        +

        inbox + token) sebagai pengganti konfigurasi env global CHATWOOT_*.

        URL dikanonisasi dan divalidasi (hanya http/https, tanpa kredensial

        tersemat, host yang mengarah ke alamat
        privat/loopback/link-local/metadata

        ditolak kecuali diizinkan melalui CHATWOOT_ALLOWED_HOSTS).

        Saat memperbarui, `api_token` kosong — atau nilai tersamarkan yang
        dikirim kembali dari GET —

        mempertahankan token yang tersimpan. Perubahan identitas perutean
        (url/account/inbox)

        ditolak dengan 409 setelah konfigurasi memiliki percakapan tertaut;
        hapus dan

        buat ulang konfigurasi untuk mengikatnya kembali.
      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: >-
                    Token API agen/bot Chatwoot. Wajib saat membuat; nilai
                    kosong (atau nilai tersamarkan) mempertahankan token
                    tersimpan saat memperbarui.
                webhook_secret:
                  type: string
                  description: >
                    Rahasia webhook saluran API inbox ini. Jika ditetapkan,
                    rahasia ini melindungi setiap

                    webhook yang dirutekan ke perangkat ini (di
                    `/chatwoot/webhook/{device_id}` dan di

                    `/chatwoot/webhook` bersama) sebagai pengganti

                    CHATWOOT_WEBHOOK_SECRET. Jangan sertakan untuk
                    mempertahankan nilai tersimpan; kirim string

                    kosong untuk menghapusnya. Tidak pernah dikembalikan oleh
                    API.
                enabled:
                  type: boolean
                  default: true
      responses:
        '200':
          description: Konfigurasi berhasil disimpan
          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: >-
            Permintaan tidak valid (INVALID_REQUEST) atau URL ditolak
            (INVALID_CHATWOOT_URL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '404':
          description: Perangkat tidak ditemukan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '409':
          description: >-
            Perubahan identitas perutean ditolak selama masih ada percakapan
            tertaut (CONFIG_HAS_LINKED_CONVERSATIONS)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
components:
  parameters:
    ChatwootConfigDeviceId:
      name: device_id
      in: path
      required: true
      description: ID perangkat (atau JID WhatsApp) yang konfigurasi Chatwoot-nya dituju
      schema:
        type: string
        example: my-device-id
  schemas:
    ChatwootDeviceConfig:
      type: object
      description: >-
        Konfigurasi perutean Chatwoot per perangkat (token API disamarkan setiap
        kali dibaca)
      properties:
        device_id:
          type: string
          example: my-device-id
        device_jid:
          type: string
          description: >-
            JID WhatsApp perangkat; diisi otomatis saat login (kosong sebelum
            pemasangan)
          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: Disamarkan; hanya 4 karakter terakhir yang ditampilkan
          example: '****1234'
        enabled:
          type: boolean
          example: true
        webhook_url:
          type: string
          description: >-
            URL yang ditetapkan pada inbox Chatwoot perangkat ini agar balasan
            agen dirutekan kembali ke perangkat ini
          example: https://gowa.example.com/chatwoot/webhook/my-device-id
        webhook_secret_set:
          type: boolean
          description: >-
            Apakah perangkat ini memiliki rahasia webhook sendiri (rahasianya
            tidak pernah dikembalikan)
          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: Kode Status HTTP
        message:
          type: string
          example: field cannot be blank
          description: Pesan kesalahan terperinci
        results:
          type: object
          example: null
          description: data tambahan
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

## Related topics

- [Integrasi Chatwoot](https://gowa-docs.mintlify.site/id/integrations/chatwoot.md)
- [Dapatkan konfigurasi Chatwoot perangkat](https://gowa-docs.mintlify.site/id/api-reference/chatwoot/dapatkan-konfigurasi-chatwoot-perangkat.md)
- [Hapus konfigurasi Chatwoot perangkat](https://gowa-docs.mintlify.site/id/api-reference/chatwoot/hapus-konfigurasi-chatwoot-perangkat.md)
- [Endpoint webhook Chatwoot per perangkat](https://gowa-docs.mintlify.site/id/api-reference/chatwoot/endpoint-webhook-chatwoot-per-perangkat.md)
- [Multi-Perangkat & Pemilihan Perangkat](https://gowa-docs.mintlify.site/id/concepts/multidevice.md)


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