Merge pull request #10 from nestordavalos/main

feat(chatwoot): import history messages to chatwoot on whatsapp connection and Added integration with the Official WhatsApp API
This commit is contained in:
Davidson Gomes 2024-03-12 09:38:57 -03:00 committed by GitHub
commit d4b344d2c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 122 additions and 4 deletions

View File

@ -127,6 +127,9 @@ const defaultObj = () => ({
sign_msg: true,
reopen_conversation: true,
conversation_pending: false,
import_contacts: false,
import_messages: false,
days_limit_import_messages: 0, // Set as a number
});
export default {

View File

@ -85,7 +85,18 @@
]"
/>
</div>
</div>
<div class="flex-grow-1">
<v-text-field
v-model.number="chatwootData.days_limit_import_messages"
:label="$t('chatwoot.dayslimitimportmessages')"
:disabled="loading"
outlined
dense
hide-details="auto"
class="mb-3"
/>
</div>
</div>
<div class="d-flex align-center gap-4 flex-wrap">
<v-checkbox
class="flex-grow-0 flex-shrink-0"
@ -150,6 +161,39 @@
</template>
</v-checkbox>
</div>
<div>
<v-checkbox
v-model="chatwootData.import_contacts"
:disabled="loading"
hide-details
class="mb-3"
density="compact"
>
<template v-slot:label>
<span>{{ $t("chatwoot.importcontacts") }}</span>
<HelpTooltip>
{{ $t("chatwoot.importcontactsHelp") }}
</HelpTooltip>
</template>
</v-checkbox>
</div>
<div>
<v-checkbox
v-model="chatwootData.import_messages"
:disabled="loading"
hide-details
class="mb-3"
density="compact"
>
<template v-slot:label>
<span>{{ $t("chatwoot.importmessages") }}</span>
<HelpTooltip>
{{ $t("chatwoot.importmessagesHelp") }}
</HelpTooltip>
</template>
</v-checkbox>
</div>
<div>
<v-checkbox
@ -217,6 +261,9 @@ const defaultObj = () => ({
reopen_conversation: true,
conversation_pending: false,
auto_create: undefined,
import_contacts: false,
import_messages: false,
days_limit_import_messages: 0,
});
export default {
@ -242,6 +289,9 @@ export default {
sign_delimiter: "\n",
reopen_conversation: true,
conversation_pending: false,
import_contacts: false,
import_messages: false,
days_limit_import_messages: 0,
},
defaultChatwootData: {
enabled: false,
@ -252,6 +302,9 @@ export default {
sign_delimiter: "\n",
reopen_conversation: true,
conversation_pending: false,
import_contacts: false,
import_messages: false,
days_limit_import_messages: 0,
},
}),
methods: {

View File

@ -81,6 +81,14 @@
hide-details
density="compact"
></v-checkbox>
<v-checkbox
class="flex-grow-0"
v-model="optionsData.sync_full_history"
:disabled="loading"
:label="$t('options.syncfullhistory')"
hide-details
density="compact"
></v-checkbox>
</div>
</v-form>
</v-card-text>
@ -112,6 +120,7 @@ const defaultOptions = () => ({
always_online: false,
read_messages: false,
read_status: false,
sync_full_history: false,
});
export default {
@ -134,6 +143,7 @@ export default {
always_online: false,
read_messages: false,
read_status: false,
sync_full_history: false,
},
defaultOptionsData: {
reject_call: false,
@ -142,6 +152,7 @@ export default {
always_online: false,
read_messages: false,
read_status: false,
sync_full_history: false,
},
}),

View File

@ -17,6 +17,26 @@
'Nome inválido (apenas letras, números, _ e -)',
]"
/>
<v-select
v-model="instance.integration"
:items="['WHATSAPP-BAILEYS', 'WHATSAPP-BUSINESS']"
:label="$t('createInstance.integration')"
required
outlined
/>
<v-text-field
v-model="instance.number"
:label="$t('createInstance.number')"
outlined
v-if="instance.integration === 'WHATSAPP-BUSINESS'"
:rules="[
(v) =>
!!v || $t('required', { field: $t('createInstance.number') }),
(v) =>
new RegExp('^[a-zA-Z0-9_-]*$', 'i').test(v) ||
'Nome inválido (apenas letras, números, _ e -)',
]"
/>
<v-text-field
v-model="instance.token"
label="API Key"
@ -72,6 +92,7 @@ export default {
instance: {
instanceName: "",
token: "",
integration: "",
},
loading: false,
error: false,
@ -106,6 +127,7 @@ export default {
this.error = false;
this.instance.instanceName = "";
this.generateApiKey();
this.instance.integration = "";
},
},

View File

@ -52,6 +52,8 @@ export default {
title: "Create instance",
name: "Instance name",
configInfo: "The WebHook, WebSocket, RabbitMQ, Chatwoot, and Typebot can be configured after creating the instance.",
integration: "Integration",
number: "Telephone number identifier",
},
contribute: {
title: "Contribute",
@ -70,7 +72,9 @@ export default {
},
connectPhone: {
title: "Phone not connected",
apiGenericError: "Could not load QR Code, if the error persists, restart the API and try again."
apiGenericError: "Could not load QR Code, if the error persists, restart the API and try again.",
qr: "QR Code",
code: "Código",
},
options: {
title: "Behavior",
@ -80,6 +84,7 @@ export default {
alwaysOnline: "Always online",
readMessages: "Mark messages as read",
readStatus: "Mark status as seen",
syncfullhistory: "sync full history",
},
webhook: {
byEvents: "Webhook by events",
@ -91,6 +96,7 @@ export default {
chatwoot: {
account_id: "Account ID",
token: "Account Token",
dayslimitimportmessages: "Days limit to import messages",
signMsg: "Sign messages",
signMsgHelp: "Adds the agent name at the first line of the message",
signDelimiter: "Signature delimiter",
@ -101,6 +107,10 @@ export default {
conversationPendingHelp: "Starts the conversation as pending instead of open",
autoCreate: "Create Inbox",
autoCreateHelp: "Creates the inbox in Chatwoot if it doesn't exist",
importcontacts: "Import contacts",
importcontactsHelp: "Import contacts to Chatwoot",
importmessages: "Import messages",
importmessagesHelp: "Import message history messages to Chatwoot",
config: {
btn: "How to configure Chatwoot?",
title: "How to configure Chatwoot inbox?",

View File

@ -52,6 +52,8 @@ export default {
title: "Crear instancia",
name: "Nombre de la instancia",
configInfo: "El WebHook, WebSocket, RabbitMQ, Chatwoot y Typebot se pueden configurar después de crear la instancia.",
integration: "Integración",
number: "Identificador de número de teléfono",
},
contribute: {
title: "Contribuir",
@ -70,7 +72,9 @@ export default {
},
connectPhone: {
title: "Teléfono no conectado",
apiGenericError: "No se pudo cargar el código QR. Si el error persiste, reinicie la API y vuelva a intentarlo.."
apiGenericError: "No se pudo cargar el código QR. Si el error persiste, reinicie la API y vuelva a intentarlo..",
qr: "QR Code",
code: "Código",
},
options: {
title: "Comportamiento",
@ -80,6 +84,7 @@ export default {
alwaysOnline: "Siempre en línea",
readMessages: "Marcar mensajes como leídos",
readStatus: "Marcar estado de lectura",
syncfullhistory: "Sincronizar el historial completo",
},
webhook: {
byEvents: "Webhook por eventos",
@ -91,6 +96,7 @@ export default {
chatwoot: {
account_id: "ID de Cuenta",
token: "Token de Cuenta",
dayslimitimportmessages: "Límite de días para importar mensajes",
signMsg: "Firmar en mensajes",
signMsgHelp: "Agrega el nombre del agente en la primera línea del mensaje.",
signDelimiter: "Delimitador de firma",
@ -101,6 +107,10 @@ export default {
conversationPendingHelp: "Inicia la conversación como pendiente en lugar de abierta",
autoCreate: "Crear bandeja de entrada",
autoCreateHelp: "Crea la bandeja de entrada en Chatwoot si no existe",
importcontacts: "Importar contactos",
importcontactsHelp: "Importa contactos a Chatwoot",
importmessages: "Importar mensajes",
importmessagesHelp: "Importa mensajes historioco de mensajes a Chatwoot",
config: {
btn: "Cómo configurar Chatwoot?",
title: "Cómo configurar la bandeja de entrada de Chatwoot?",

View File

@ -19,7 +19,7 @@ export default {
noInstances: "Nenhuma instância encontrada",
unknown: "Desconhecido",
required: "{field} é obrigatório",
maxLength: "{field} deve ter no máximo {length} caracteres",
maxLength: "{field} deve ter no máximo {length} caracteres",
https: "{field} deve começar com https://",
httpHttps: "{field} deve começar com http:// ou https://",
enabled: "Habilitado",
@ -52,6 +52,8 @@ export default {
title: "Criar instância",
name: "Nome da instância",
configInfo: "O WebHook, WebSocket, RabbitMQ, Chatwoot e Typebot poderão ser configurados após a criação da instância.",
integration: "Integração",
number: "Identificador de número de telefone",
},
contribute: {
title: "Contribuir",
@ -82,6 +84,7 @@ export default {
alwaysOnline: "Sempre online",
readMessages: "Marcar mensagens como lidas",
readStatus: "Marcar status como visto",
syncfullhistory: "Sincronizar el historial completo",
},
webhook: {
byEvents: "Webhook por eventos",
@ -93,6 +96,7 @@ export default {
chatwoot: {
account_id: "ID da conta",
token: "Token da conta",
dayslimitimportmessages: "Limite de dias para importar mensagens",
signMsg: "Assinar mensagens",
signMsgHelp: "Adiciona o nome do atendente na primeira linha da mensagem",
signDelimiter: "Separador da assinatura da mensagem",
@ -103,6 +107,10 @@ export default {
conversationPendingHelp: "Inicia a conversa como pendente ao invés de aberta",
autoCreate: "Criar Caixa de Entrada",
autoCreateHelp: "Cria a caixa de entrada no Chatwoot caso ela não exista",
importcontacts: "Importar contatos",
importcontactsHelp: "Importar contatos para o Chatwoot",
importmessages: "Importar mensagens",
importmessagesHelp: "Importar mensagens do histórico de mensagens para o Chatwoot",
config: {
btn: "Como configurar o chatwoot?",
title: "Como configurar a caixa de entrada do Chatwoot?",

View File

@ -52,6 +52,7 @@ export default {
lang_list: [
{ title: "Português", value: "pt_br" },
{ title: "English", value: "en" },
{ title: "Español", value: "es" },
],
DocStore: useDocStore(),
}),