feat(chatwoot): read messages from whatsapp in chatwoot

It works only with messages read from whatsapp to chatwoot.
This commit is contained in:
jaison-x
2024-01-15 20:20:02 -03:00
parent 29a48f7914
commit c75dfcd499
3 changed files with 71 additions and 9 deletions

View File

@@ -1932,6 +1932,13 @@ export class WAStartupService {
this.logger.verbose('group ignored');
return;
}
if (status[update.status] === 'READ' && key.fromMe) {
if (this.localChatwoot.enabled) {
this.chatwootService.eventWhatsapp('messages.read', { instanceName: this.instance.name }, { key: key });
}
}
// if (key.remoteJid !== 'status@broadcast' && !key?.remoteJid?.match(/(:\d+)/)) {
if (key.remoteJid !== 'status@broadcast') {
this.logger.verbose('Message update is valid');
@@ -2877,8 +2884,8 @@ export class WAStartupService {
this.logger.verbose('Processing audio');
let tempAudioPath: string;
let outputAudio: string;
number = number.replace(/\D/g, "");
number = number.replace(/\D/g, '');
const hash = `${number}-${new Date().getTime()}`;
this.logger.verbose('Hash to audio name: ' + hash);