mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 09:51:24 -06:00
fix: receive medias on chatwoot
This commit is contained in:
parent
5401ecd2c4
commit
34769e2293
@ -933,11 +933,13 @@ export class ChatwootService {
|
||||
) {
|
||||
if (sourceId && this.isImportHistoryAvailable()) {
|
||||
const messageAlreadySaved = await chatwootImport.getExistingSourceIds([sourceId]);
|
||||
if (messageAlreadySaved) {
|
||||
if (messageAlreadySaved.size > 0) {
|
||||
this.logger.warn('Message already saved on chatwoot');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = new FormData();
|
||||
|
||||
if (content) {
|
||||
@ -2442,6 +2444,7 @@ export class ChatwootService {
|
||||
chatwootConfig: ChatwootDto,
|
||||
prepareMessage: (message: any) => any,
|
||||
) {
|
||||
try {
|
||||
if (!this.isImportHistoryAvailable()) {
|
||||
return;
|
||||
}
|
||||
@ -2494,5 +2497,8 @@ export class ChatwootService {
|
||||
await chatwootImport.importHistoryMessages(instance, this, inbox, this.provider);
|
||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||
waInstance.clearCacheChatwoot();
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +170,7 @@ class ChatwootImport {
|
||||
}
|
||||
|
||||
public async getExistingSourceIds(sourceIds: string[]): Promise<Set<string>> {
|
||||
try {
|
||||
const existingSourceIdsSet = new Set<string>();
|
||||
|
||||
if (sourceIds.length === 0) {
|
||||
@ -186,6 +187,9 @@ class ChatwootImport {
|
||||
}
|
||||
|
||||
return existingSourceIdsSet;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async importHistoryMessages(
|
||||
|
Loading…
Reference in New Issue
Block a user