feat(chatwoot): import history messages to chatwoot on whatsapp connection

Messages are imported direct to chatwoot database. Media and group messages are ignored.

New env.yml variables:
CHATWOOT_IMPORT_DATABASE_CONNECTION_URI: URI to connect direct on chatwoot database.
CHATWOOT_IMPORT_PLACEHOLDER_MEDIA_MESSAGE: Indicates to use a text placeholder on media messages.

New instance setting:
sync_full_history: Indicates to request a full history sync to baileys.

New chatwoot options:
import_contacts: Indicates to import contacts.
import_messages: Indicates to import messages.
days_limit_import_messages: Number of days to limit history messages to import.
This commit is contained in:
jaison-x
2024-01-31 11:20:29 -03:00
parent b09546577a
commit 8a5ebe83a3
23 changed files with 992 additions and 111 deletions

View File

@@ -2076,6 +2076,9 @@ paths:
read_status:
type: boolean
description: "Indicates whether to mark status messages as read."
sync_full_history:
type: boolean
description: "Indicates whether to request a full history messages sync on connect."
parameters:
- name: instanceName
in: path
@@ -2141,6 +2144,15 @@ paths:
conversation_pending:
type: boolean
description: "Indicates whether to mark conversations as pending."
import_contacts:
type: boolean
description: "Indicates whether to import contacts from phone to Chatwoot when connecting."
import_messages:
type: boolean
description: "Indicates whether to import messages from phone to Chatwoot when connecting."
days_limit_import_messages:
type: number
description: "Indicates number of days to limit messages imported to Chatwoot."
parameters:
- name: instanceName
in: path