mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
feat: Organization configuration and logo in chatwoot bot contact
This commit is contained in:
parent
a8937bd8b1
commit
31258a9b85
@ -7,6 +7,7 @@
|
||||
* Added typebot integration activation
|
||||
* Now you can register several typebots with triggers
|
||||
* Media sent to typebot now goes as a template string, example: imageMessage:MESSAGE_ID
|
||||
* Organization configuration and logo in chatwoot bot contact
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Chatwoot" ADD COLUMN "logo" VARCHAR(500),
|
||||
ADD COLUMN "organization" VARCHAR(100);
|
@ -171,6 +171,8 @@ model Chatwoot {
|
||||
importContacts Boolean? @default(false)
|
||||
importMessages Boolean? @default(false)
|
||||
daysLimitImportMessages Int? @db.Int
|
||||
organization String? @db.VarChar(100)
|
||||
logoUrl String? @db.VarChar(500)
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
@ -170,6 +170,8 @@ model Chatwoot {
|
||||
importContacts Boolean? @default(false) @db.Boolean
|
||||
importMessages Boolean? @default(false) @db.Boolean
|
||||
daysLimitImportMessages Int? @db.Integer
|
||||
organization String? @db.VarChar(100)
|
||||
logo String? @db.VarChar(500)
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
@ -86,6 +86,8 @@ export class InstanceController {
|
||||
chatwootMergeBrazilContacts,
|
||||
chatwootImportMessages,
|
||||
chatwootDaysLimitImportMessages,
|
||||
chatwootOrganization,
|
||||
chatwootLogo,
|
||||
}: InstanceDto) {
|
||||
try {
|
||||
await this.authService.checkDuplicateToken(token);
|
||||
@ -383,6 +385,8 @@ export class InstanceController {
|
||||
mergeBrazilContacts: chatwootMergeBrazilContacts ?? false,
|
||||
importMessages: chatwootImportMessages ?? true,
|
||||
daysLimitImportMessages: chatwootDaysLimitImportMessages ?? 60,
|
||||
organization: chatwootOrganization,
|
||||
logo: chatwootLogo,
|
||||
autoCreate: true,
|
||||
});
|
||||
} catch (error) {
|
||||
|
@ -29,6 +29,8 @@ export class InstanceDto {
|
||||
chatwootImportMessages?: boolean;
|
||||
chatwootDaysLimitImportMessages?: number;
|
||||
chatwootNameInbox?: string;
|
||||
chatwootOrganization?: string;
|
||||
chatwootLogo?: string;
|
||||
websocketEnabled?: boolean;
|
||||
websocketEvents?: string[];
|
||||
rabbitmqEnabled?: boolean;
|
||||
|
@ -39,22 +39,6 @@ export class ChatwootController {
|
||||
if (data.signMsg === false) data.signDelimiter = null;
|
||||
}
|
||||
|
||||
if (!data.enabled) {
|
||||
data.accountId = '';
|
||||
data.token = '';
|
||||
data.url = '';
|
||||
data.signMsg = false;
|
||||
data.signDelimiter = null;
|
||||
data.reopenConversation = false;
|
||||
data.conversationPending = false;
|
||||
data.importContacts = false;
|
||||
data.importMessages = false;
|
||||
data.mergeBrazilContacts = false;
|
||||
data.daysLimitImportMessages = 0;
|
||||
data.autoCreate = false;
|
||||
data.nameInbox = '';
|
||||
}
|
||||
|
||||
if (!data.nameInbox || data.nameInbox === '') {
|
||||
data.nameInbox = instance.instanceName;
|
||||
}
|
||||
|
@ -14,4 +14,6 @@ export class ChatwootDto {
|
||||
importMessages?: boolean;
|
||||
daysLimitImportMessages?: number;
|
||||
autoCreate?: boolean;
|
||||
organization?: string;
|
||||
logo?: string;
|
||||
}
|
||||
|
@ -115,6 +115,8 @@ export class ChatwootService {
|
||||
`${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
||||
true,
|
||||
data.number,
|
||||
data.organization,
|
||||
data.logo,
|
||||
);
|
||||
}
|
||||
return data;
|
||||
@ -161,6 +163,8 @@ export class ChatwootService {
|
||||
webhookUrl: string,
|
||||
qrcode: boolean,
|
||||
number: string,
|
||||
organization?: string,
|
||||
logo?: string,
|
||||
) {
|
||||
const client = await this.clientCw(instance);
|
||||
|
||||
@ -218,8 +222,8 @@ export class ChatwootService {
|
||||
'123456',
|
||||
inboxId,
|
||||
false,
|
||||
'EvolutionAPI',
|
||||
'https://evolution-api.com/files/evolution-api-favicon.png',
|
||||
organization ? organization : 'EvolutionAPI',
|
||||
logo ? logo : 'https://evolution-api.com/files/evolution-api-favicon.png',
|
||||
)) as any);
|
||||
|
||||
if (!contact) {
|
||||
|
@ -314,6 +314,8 @@ export class ChannelStartupService {
|
||||
importContacts: data.importContacts,
|
||||
importMessages: data.importMessages,
|
||||
daysLimitImportMessages: data.daysLimitImportMessages,
|
||||
organization: data.organization,
|
||||
logo: data.logo,
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user