Merge branch 'develop' of https://github.com/EvolutionAPI/evolution-api into develop

This commit is contained in:
CodePhix 2023-12-06 15:54:37 -03:00
commit 333816fb86
5 changed files with 29 additions and 20 deletions

View File

@ -3,6 +3,7 @@
### Feature
* Added AWS SQS Integration
* Added compatibility with typebot v2
* Added endpoint sendPresence
### Fixed
@ -16,6 +17,8 @@
* Removed await from webhook when sending a message
* Update typebot.service.ts - element.underline change ~ for *
* Adjusts in proxy
* Removed api restart on receiving an error
* Fixes in mongodb and chatwoot
# 1.5.4 (2023-10-09 20:43)

View File

@ -8,7 +8,7 @@ export function onUnexpectedError() {
stderr: process.stderr.fd,
error,
});
process.exit(1);
// process.exit(1);
});
process.on('unhandledRejection', (error, origin) => {
@ -18,6 +18,6 @@ export function onUnexpectedError() {
stderr: process.stderr.fd,
error,
});
process.exit(1);
// process.exit(1);
});
}

View File

@ -106,7 +106,7 @@ export async function useMultiFileAuthStateDb(
},
},
saveCreds: async () => {
return writeData(creds, 'creds');
return await writeData(creds, 'creds');
},
};
}

View File

@ -1023,6 +1023,10 @@ export class ChatwootService {
const state = waInstance?.connectionStatus?.state;
if (state !== 'open') {
if (state === 'close') {
this.logger.verbose('request cleaning up instance: ' + instance.instanceName);
await this.waMonitor.cleaningUp(instance.instanceName);
}
this.logger.verbose('connect to whatsapp');
const number = command.split(':')[1];
await waInstance.connectToWhatsapp(number);
@ -1331,13 +1335,6 @@ export class ChatwootService {
public async eventWhatsapp(event: string, instance: InstanceDto, body: any) {
this.logger.verbose('event whatsapp to instance: ' + instance.instanceName);
try {
const client = await this.clientCw(instance);
if (!client) {
this.logger.warn('client not found');
return null;
}
const waInstance = this.waMonitor.waInstances[instance.instanceName];
if (!waInstance) {
@ -1345,6 +1342,13 @@ export class ChatwootService {
return null;
}
const client = await this.clientCw(instance);
if (!client) {
this.logger.warn('client not found');
return null;
}
if (event === 'messages.upsert' || event === 'send.message') {
this.logger.verbose('event messages.upsert');
@ -1600,16 +1604,18 @@ export class ChatwootService {
await this.createBotMessage(instance, msgStatus, 'incoming');
}
// if (event === 'connection.update') {
// this.logger.verbose('event connection.update');
if (event === 'connection.update') {
this.logger.verbose('event connection.update');
// if (body.status === 'open') {
// const msgConnection = `🚀 Connection successfully established!`;
// this.logger.verbose('send message to chatwoot');
// await this.createBotMessage(instance, msgConnection, 'incoming');
// }
// }
if (body.status === 'open') {
// if we have qrcode count then we understand that a new connection was established
if (this.waMonitor.waInstances[instance.instanceName].qrCode.count > 0) {
const msgConnection = `🚀 Connection successfully established!`;
this.logger.verbose('send message to chatwoot');
await this.createBotMessage(instance, msgConnection, 'incoming');
}
}
}
if (event === 'qrcode.updated') {
this.logger.verbose('event qrcode.updated');

View File

@ -263,7 +263,7 @@ export class TypebotService {
prefilledVariables: {
...data.prefilledVariables,
remoteJid: data.remoteJid,
pushName: data.pushName || '',
pushName: data.pushName || data.prefilledVariables?.pushName || '',
instanceName: instance.instanceName,
},
},