Merge branch 'main' of github.com:apresentame/evolution-api into fix/webhook_event

This commit is contained in:
William Dumes 2025-08-01 09:41:28 -03:00
commit fe8280ab7b
6 changed files with 36 additions and 20 deletions

View File

@ -1,5 +1,10 @@
# 2.3.1 (develop) # 2.3.1 (develop)
### Feature
* Add BaileysMessageProcessor for improved message handling and integrate rxjs for asynchronous processing
* Enhance message processing with retry logic for error handling
### Fixed ### Fixed
* Update Baileys Version * Update Baileys Version
@ -8,6 +13,9 @@
* Add unreadMessages in the response * Add unreadMessages in the response
* Phone number as message ID for Evo AI * Phone number as message ID for Evo AI
* Fix upload to s3 when media message * Fix upload to s3 when media message
* Simplify edited message check in BaileysStartupService
* Avoid corrupting URLs with query strings
* Removed CONFIG_SESSION_PHONE_VERSION environment variable
# 2.3.0 (2025-06-17 09:19) # 2.3.0 (2025-06-17 09:19)

View File

@ -94,7 +94,6 @@ services:
- WEBHOOK_EVENTS_ERRORS_WEBHOOK= - WEBHOOK_EVENTS_ERRORS_WEBHOOK=
- CONFIG_SESSION_PHONE_CLIENT=Evolution API V2 - CONFIG_SESSION_PHONE_CLIENT=Evolution API V2
- CONFIG_SESSION_PHONE_NAME=Chrome - CONFIG_SESSION_PHONE_NAME=Chrome
#- CONFIG_SESSION_PHONE_VERSION=2.3000.1023204200
- QRCODE_LIMIT=30 - QRCODE_LIMIT=30
- OPENAI_ENABLED=true - OPENAI_ENABLED=true
- DIFY_ENABLED=true - DIFY_ENABLED=true

View File

@ -549,17 +549,18 @@ export class BaileysStartupService extends ChannelStartupService {
this.logger.info(`Browser: ${browser}`); this.logger.info(`Browser: ${browser}`);
} }
let version; const baileysVersion = await fetchLatestWaWebVersion({});
let log; const version = baileysVersion.version;
const log = `Baileys version: ${version.join('.')}`;
if (session.VERSION) { // if (session.VERSION) {
version = session.VERSION.split('.'); // version = session.VERSION.split('.');
log = `Baileys version env: ${version}`; // log = `Baileys version env: ${version}`;
} else { // } else {
const baileysVersion = await fetchLatestWaWebVersion({}); // const baileysVersion = await fetchLatestWaWebVersion({});
version = baileysVersion.version; // version = baileysVersion.version;
log = `Baileys version: ${version}`; // log = `Baileys version: ${version}`;
} // }
this.logger.info(log); this.logger.info(log);
@ -1059,6 +1060,8 @@ export class BaileysStartupService extends ChannelStartupService {
'failed to decrypt message', 'failed to decrypt message',
'SessionError', 'SessionError',
'Invalid PreKey ID', 'Invalid PreKey ID',
'No session record',
'No session found to decrypt message',
].some((err) => param?.includes?.(err)), ].some((err) => param?.includes?.(err)),
) )
) { ) {
@ -2559,7 +2562,9 @@ export class BaileysStartupService extends ChannelStartupService {
imageBuffer = Buffer.from(base64Data, 'base64'); imageBuffer = Buffer.from(base64Data, 'base64');
} else { } else {
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
const url = `${image}?timestamp=${timestamp}`; const parsedURL = new URL(image);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
let config: any = { responseType: 'arraybuffer' }; let config: any = { responseType: 'arraybuffer' };
@ -2780,7 +2785,9 @@ export class BaileysStartupService extends ChannelStartupService {
if (isURL(audio)) { if (isURL(audio)) {
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
const url = `${audio}?timestamp=${timestamp}`; const parsedURL = new URL(audio);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
const config: any = { responseType: 'stream' }; const config: any = { responseType: 'stream' };
@ -3709,7 +3716,9 @@ export class BaileysStartupService extends ChannelStartupService {
let pic: WAMediaUpload; let pic: WAMediaUpload;
if (isURL(picture)) { if (isURL(picture)) {
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
const url = `${picture}?timestamp=${timestamp}`; const parsedURL = new URL(picture);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
let config: any = { responseType: 'arraybuffer' }; let config: any = { responseType: 'arraybuffer' };
@ -4001,7 +4010,9 @@ export class BaileysStartupService extends ChannelStartupService {
let pic: WAMediaUpload; let pic: WAMediaUpload;
if (isURL(picture.image)) { if (isURL(picture.image)) {
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
const url = `${picture.image}?timestamp=${timestamp}`; const parsedURL = new URL(picture.image);
parsedURL.searchParams.set('timestamp', timestamp.toString());
const url = parsedURL.toString();
let config: any = { responseType: 'arraybuffer' }; let config: any = { responseType: 'arraybuffer' };

View File

@ -681,7 +681,7 @@ export class ChatwootService {
instance, instance,
body.key.participant.split('@')[0], body.key.participant.split('@')[0],
filterInbox.id, filterInbox.id,
isGroup, false,
body.pushName, body.pushName,
picture_url.profilePictureUrl || null, picture_url.profilePictureUrl || null,
body.key.participant, body.key.participant,

View File

@ -69,8 +69,7 @@ router
clientName: process.env.DATABASE_CONNECTION_CLIENT_NAME, clientName: process.env.DATABASE_CONNECTION_CLIENT_NAME,
manager: !serverConfig.DISABLE_MANAGER ? `${req.protocol}://${req.get('host')}/manager` : undefined, manager: !serverConfig.DISABLE_MANAGER ? `${req.protocol}://${req.get('host')}/manager` : undefined,
documentation: `https://doc.evolution-api.com`, documentation: `https://doc.evolution-api.com`,
whatsappWebVersion: whatsappWebVersion: (await fetchLatestWaWebVersion({})).version.join('.'),
process.env.CONFIG_SESSION_PHONE_VERSION || (await fetchLatestWaWebVersion({})).version.join('.'),
}); });
}) })
.post('/verify-creds', authGuard['apikey'], async (req, res) => { .post('/verify-creds', authGuard['apikey'], async (req, res) => {

View File

@ -249,7 +249,7 @@ export type Webhook = {
}; };
}; };
export type Pusher = { ENABLED: boolean; GLOBAL?: GlobalPusher; EVENTS: EventsPusher }; export type Pusher = { ENABLED: boolean; GLOBAL?: GlobalPusher; EVENTS: EventsPusher };
export type ConfigSessionPhone = { CLIENT: string; NAME: string; VERSION: string }; export type ConfigSessionPhone = { CLIENT: string; NAME: string };
export type QrCode = { LIMIT: number; COLOR: string }; export type QrCode = { LIMIT: number; COLOR: string };
export type Typebot = { ENABLED: boolean; API_VERSION: string; SEND_MEDIA_BASE64: boolean }; export type Typebot = { ENABLED: boolean; API_VERSION: string; SEND_MEDIA_BASE64: boolean };
export type Chatwoot = { export type Chatwoot = {
@ -590,7 +590,6 @@ export class ConfigService {
CONFIG_SESSION_PHONE: { CONFIG_SESSION_PHONE: {
CLIENT: process.env?.CONFIG_SESSION_PHONE_CLIENT || 'Evolution API', CLIENT: process.env?.CONFIG_SESSION_PHONE_CLIENT || 'Evolution API',
NAME: process.env?.CONFIG_SESSION_PHONE_NAME || 'Chrome', NAME: process.env?.CONFIG_SESSION_PHONE_NAME || 'Chrome',
VERSION: process.env?.CONFIG_SESSION_PHONE_VERSION || null,
}, },
QRCODE: { QRCODE: {
LIMIT: Number.parseInt(process.env.QRCODE_LIMIT) || 30, LIMIT: Number.parseInt(process.env.QRCODE_LIMIT) || 30,