Update chatwoot.service.ts

fix: message can be undefined
This commit is contained in:
jaison-x 2023-12-19 17:10:33 -03:00
parent 3545b80050
commit 244fe0835e

View File

@ -1204,9 +1204,10 @@ export class ChatwootService {
}
private updateChatwootMessageId(message: MessageRaw, chatwootMessageId: string, instance: InstanceDto) {
if (!chatwootMessageId) {
if (!chatwootMessageId || !message?.key?.id) {
return;
}
message.chatwootMessageId = chatwootMessageId;
this.repository.message.update([message], instance.instanceName, true);
}