mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 01:48:39 -06:00
fix: send media message in chatwoot
This commit is contained in:
parent
373268c938
commit
db065ab942
@ -1196,8 +1196,10 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.configService.get<Database>('DATABASE').SAVE_DATA.CONTACTS)
|
if (this.configService.get<Database>('DATABASE').SAVE_DATA.CONTACTS)
|
||||||
await this.prismaRepository.contact.create({
|
await this.prismaRepository.contact.upsert({
|
||||||
data: contactRaw,
|
where: { remoteJid_instanceId: { remoteJid: contactRaw.remoteJid, instanceId: contactRaw.instanceId } },
|
||||||
|
create: contactRaw,
|
||||||
|
update: contactRaw,
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -540,7 +540,6 @@ export class ChatwootService {
|
|||||||
try {
|
try {
|
||||||
this.logger.verbose('--- Start createConversation ---');
|
this.logger.verbose('--- Start createConversation ---');
|
||||||
this.logger.verbose(`Instance: ${JSON.stringify(instance)}`);
|
this.logger.verbose(`Instance: ${JSON.stringify(instance)}`);
|
||||||
this.logger.verbose(`Body: ${JSON.stringify(body)}`);
|
|
||||||
|
|
||||||
const client = await this.clientCw(instance);
|
const client = await this.clientCw(instance);
|
||||||
|
|
||||||
@ -1122,7 +1121,7 @@ export class ChatwootService {
|
|||||||
data.caption = caption;
|
data.caption = caption;
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageSent = await waInstance?.mediaMessage(data, true);
|
const messageSent = await waInstance?.mediaMessage(data, null, true);
|
||||||
|
|
||||||
return messageSent;
|
return messageSent;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -410,6 +410,7 @@ export class DifyService {
|
|||||||
media: url,
|
media: url,
|
||||||
caption: altText,
|
caption: altText,
|
||||||
},
|
},
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ export class EvolutionBotService {
|
|||||||
private readonly waMonitor: WAMonitoringService,
|
private readonly waMonitor: WAMonitoringService,
|
||||||
private readonly configService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
private readonly prismaRepository: PrismaRepository,
|
private readonly prismaRepository: PrismaRepository,
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
private readonly logger = new Logger('EvolutionBotService');
|
private readonly logger = new Logger('EvolutionBotService');
|
||||||
|
|
||||||
@ -150,20 +150,18 @@ export class EvolutionBotService {
|
|||||||
delay: settings?.delayMessage || 1000,
|
delay: settings?.delayMessage || 1000,
|
||||||
text: textBuffer.trim(),
|
text: textBuffer.trim(),
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
textBuffer = '';
|
textBuffer = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaType === 'audio') {
|
if (mediaType === 'audio') {
|
||||||
await instance.audioWhatsapp(
|
await instance.audioWhatsapp({
|
||||||
{
|
number: remoteJid.split('@')[0],
|
||||||
number: remoteJid.split('@')[0],
|
delay: settings?.delayMessage || 1000,
|
||||||
delay: settings?.delayMessage || 1000,
|
audio: url,
|
||||||
audio: url,
|
caption: altText,
|
||||||
caption: altText,
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
await instance.mediaMessage(
|
await instance.mediaMessage(
|
||||||
{
|
{
|
||||||
@ -173,7 +171,8 @@ export class EvolutionBotService {
|
|||||||
media: url,
|
media: url,
|
||||||
caption: altText,
|
caption: altText,
|
||||||
},
|
},
|
||||||
false
|
null,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +196,7 @@ export class EvolutionBotService {
|
|||||||
delay: settings?.delayMessage || 1000,
|
delay: settings?.delayMessage || 1000,
|
||||||
text: textBuffer.trim(),
|
text: textBuffer.trim(),
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +213,6 @@ export class EvolutionBotService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async initNewSession(
|
private async initNewSession(
|
||||||
instance: any,
|
instance: any,
|
||||||
remoteJid: string,
|
remoteJid: string,
|
||||||
|
@ -171,6 +171,7 @@ export class FlowiseService {
|
|||||||
media: url,
|
media: url,
|
||||||
caption: altText,
|
caption: altText,
|
||||||
},
|
},
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -216,6 +216,7 @@ export class OpenaiService {
|
|||||||
media: url,
|
media: url,
|
||||||
caption: altText,
|
caption: altText,
|
||||||
},
|
},
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,7 @@ export class TypebotService {
|
|||||||
mediatype: 'image',
|
mediatype: 'image',
|
||||||
media: message.content.url,
|
media: message.content.url,
|
||||||
},
|
},
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -257,6 +258,7 @@ export class TypebotService {
|
|||||||
mediatype: 'video',
|
mediatype: 'video',
|
||||||
media: message.content.url,
|
media: message.content.url,
|
||||||
},
|
},
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user