mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 09:28:39 -06:00
feat: Update chatwoot source ID and status after sent
This commit is contained in:
parent
e241cf4ee0
commit
f9726863ef
@ -1453,6 +1453,10 @@ export class ChatwootService {
|
|||||||
chatwootIsRead: chatwootMessageIds.isRead,
|
chatwootIsRead: chatwootMessageIds.isRead,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.isImportHistoryAvailable()) {
|
||||||
|
chatwootImport.updateMessageSourceID(chatwootMessageIds.messageId, key.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getMessageByKeyId(instance: InstanceDto, keyId: string): Promise<MessageModel> {
|
private async getMessageByKeyId(instance: InstanceDto, keyId: string): Promise<MessageModel> {
|
||||||
|
@ -542,6 +542,14 @@ class ChatwootImport {
|
|||||||
public isIgnorePhoneNumber(remoteJid: string) {
|
public isIgnorePhoneNumber(remoteJid: string) {
|
||||||
return this.isGroup(remoteJid) || remoteJid === 'status@broadcast' || remoteJid === '0@s.whatsapp.net';
|
return this.isGroup(remoteJid) || remoteJid === 'status@broadcast' || remoteJid === '0@s.whatsapp.net';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updateMessageSourceID(messageId: string | number, sourceId: string) {
|
||||||
|
const pgClient = postgresClient.getChatwootConnection();
|
||||||
|
|
||||||
|
const sql = `UPDATE messages SET source_id = $1, status = 0 WHERE id = $2;`;
|
||||||
|
|
||||||
|
return pgClient.query(sql, [`WAID:${sourceId}`, messageId]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const chatwootImport = new ChatwootImport();
|
export const chatwootImport = new ChatwootImport();
|
||||||
|
Loading…
Reference in New Issue
Block a user