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