feat(chatwoot): show edited messages from WhatsApp in Chatwoot

This commit is contained in:
jaison-x
2024-03-15 14:01:21 -03:00
parent 901954de33
commit 3b774558f4
4 changed files with 43 additions and 2 deletions

View File

@@ -937,6 +937,17 @@ export class BaileysStartupService extends WAStartupService {
try {
this.logger.verbose('Event received: messages.upsert');
for (const received of messages) {
if (
this.localChatwoot.enabled &&
(received.message?.protocolMessage?.editedMessage || received.message?.editedMessage?.message)
) {
const editedMessage =
received.message?.protocolMessage || received.message?.editedMessage?.message?.protocolMessage;
if (editedMessage) {
this.chatwootService.eventWhatsapp('messages.edit', { instanceName: this.instance.name }, editedMessage);
}
}
if (
(type !== 'notify' && type !== 'append') ||
received.message?.protocolMessage ||