> ## 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へのWhatsAppメッセージ履歴のバックグラウンド同期を開始します。
設定した日数からのメッセージがインポートされます。
このエンドポイントには、設定で CHATWOOT_ENABLED=true が必要です。




## OpenAPI

````yaml /ja/openapi.yml post /chatwoot/sync
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:
  /chatwoot/sync:
    post:
      tags:
        - chatwoot
      summary: チャットウッドにメッセージ履歴を同期
      description: |
        ChatwootへのWhatsAppメッセージ履歴のバックグラウンド同期を開始します。
        設定した日数からのメッセージがインポートされます。
        このエンドポイントには、設定で CHATWOOT_ENABLED=true が必要です。
      operationId: chatwootSyncHistory
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: string
                  description: 同期するデバイス ID (指定されていない場合は CHATWOOT_DEVICE_ID を使用)
                days_limit:
                  type: integer
                  default: 3
                  description: 同期する日数の履歴
                include_media:
                  type: boolean
                  default: true
                  description: メディア添付ファイルを同期に含める
                include_groups:
                  type: boolean
                  default: true
                  description: グループチャットを同期に含める
      responses:
        '200':
          description: 同期の開始に成功しました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatwootSyncResponse'
        '400':
          description: 不正なリクエスト（デバイスが見つからないか、Chatwootが設定されていません）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '409':
          description: 同期はすでに進行中です
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 409
                  code:
                    type: string
                    example: SYNC_ALREADY_RUNNING
                  message:
                    type: string
                    example: A sync is already in progress for this device
                  results:
                    type: object
                    properties:
                      progress: 384d4766-7d57-40b0-b241-8c4336148e93
components:
  schemas:
    ChatwootSyncResponse:
      type: object
      properties:
        status:
          type: integer
          example: 200
        code:
          type: string
          example: SYNC_STARTED
        message:
          type: string
          example: History sync initiated in background
        results:
          type: object
          properties:
            device_id:
              type: string
              example: my-device-id
            days_limit:
              type: integer
              example: 3
            include_media:
              type: boolean
              example: true
            include_groups:
              type: boolean
              example: true
    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

- [メッセージの受信](https://gowa-docs.mintlify.site/ja/examples/receiving-messages.md)
- [携帯電話から古いチャット履歴をリクエストする](https://gowa-docs.mintlify.site/ja/api-reference/chat/携帯電話から古いチャット履歴をリクエストする.md)
- [特定のチャットからメッセージを取得する](https://gowa-docs.mintlify.site/ja/api-reference/chat/特定のチャットからメッセージを取得する.md)
- [音声メッセージを再生済みにする](https://gowa-docs.mintlify.site/ja/api-reference/message/音声メッセージを再生済みにする.md)
- [Chatwoot統合](https://gowa-docs.mintlify.site/ja/integrations/chatwoot.md)


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