fix: Validate if source id already exists in chatwoot

Check if message is already saved before sending it
This commit is contained in:
Judson Cairo
2024-09-25 11:56:51 -03:00
parent e241cf4ee0
commit f54a00a07f
2 changed files with 10 additions and 2 deletions

View File

@@ -890,6 +890,13 @@ export class ChatwootService {
sourceId?: string,
quotedMsg?: MessageModel,
) {
if (sourceId) {
const messageAlreadySaved = await chatwootImport.getExistingSourceIds([sourceId]);
if (messageAlreadySaved.size > 0) {
this.logger.warn('Message already saved on chatwoot');
return null;
}
}
const data = new FormData();
if (content) {