mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
refactor: chatbot integration
This commit is contained in:
parent
9209c9992d
commit
e7d971867b
@ -2010,12 +2010,14 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await chatbotController.emit({
|
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled && isIntegration)
|
||||||
instance: { instanceName: this.instance.name, instanceId: this.instanceId },
|
await chatbotController.emit({
|
||||||
remoteJid: messageRaw.key.remoteJid,
|
instance: { instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
msg: messageRaw,
|
remoteJid: messageRaw.key.remoteJid,
|
||||||
pushName: messageRaw.pushName,
|
msg: messageRaw,
|
||||||
});
|
pushName: messageRaw.pushName,
|
||||||
|
isIntegration,
|
||||||
|
});
|
||||||
|
|
||||||
if (this.configService.get<Database>('DATABASE').SAVE_DATA.NEW_MESSAGE)
|
if (this.configService.get<Database>('DATABASE').SAVE_DATA.NEW_MESSAGE)
|
||||||
await this.prismaRepository.message.create({
|
await this.prismaRepository.message.create({
|
||||||
|
@ -923,12 +923,13 @@ export class BusinessStartupService extends ChannelStartupService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await chatbotController.emit({
|
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled && isIntegration)
|
||||||
instance: { instanceName: this.instance.name, instanceId: this.instanceId },
|
await chatbotController.emit({
|
||||||
remoteJid: messageRaw.key.remoteJid,
|
instance: { instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
msg: messageRaw,
|
remoteJid: messageRaw.key.remoteJid,
|
||||||
pushName: messageRaw.pushName,
|
msg: messageRaw,
|
||||||
});
|
pushName: messageRaw.pushName,
|
||||||
|
});
|
||||||
|
|
||||||
await this.prismaRepository.message.create({
|
await this.prismaRepository.message.create({
|
||||||
data: messageRaw,
|
data: messageRaw,
|
||||||
|
@ -68,17 +68,20 @@ export class ChatbotController {
|
|||||||
remoteJid,
|
remoteJid,
|
||||||
msg,
|
msg,
|
||||||
pushName,
|
pushName,
|
||||||
|
isIntegration = false,
|
||||||
}: {
|
}: {
|
||||||
instance: InstanceDto;
|
instance: InstanceDto;
|
||||||
remoteJid: string;
|
remoteJid: string;
|
||||||
msg: any;
|
msg: any;
|
||||||
pushName?: string;
|
pushName?: string;
|
||||||
|
isIntegration?: boolean;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const emitData = {
|
const emitData = {
|
||||||
instance,
|
instance,
|
||||||
remoteJid,
|
remoteJid,
|
||||||
msg,
|
msg,
|
||||||
pushName,
|
pushName,
|
||||||
|
isIntegration,
|
||||||
};
|
};
|
||||||
// typebot
|
// typebot
|
||||||
await typebotController.emit(emitData);
|
await typebotController.emit(emitData);
|
||||||
|
Loading…
Reference in New Issue
Block a user