Skip to content

Commit fe8280a

Browse files
committed
Merge branch 'main' of github.com:apresentame/evolution-api into fix/webhook_event
2 parents bc11d0f + 9cdb897 commit fe8280a

File tree

6 files changed

+37
-21
lines changed

6 files changed

+37
-21
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 2.3.1 (develop)
22

3+
### Feature
4+
5+
* Add BaileysMessageProcessor for improved message handling and integrate rxjs for asynchronous processing
6+
* Enhance message processing with retry logic for error handling
7+
38
### Fixed
49

510
* Update Baileys Version
@@ -8,6 +13,9 @@
813
* Add unreadMessages in the response
914
* Phone number as message ID for Evo AI
1015
* Fix upload to s3 when media message
16+
* Simplify edited message check in BaileysStartupService
17+
* Avoid corrupting URLs with query strings
18+
* Removed CONFIG_SESSION_PHONE_VERSION environment variable
1119

1220
# 2.3.0 (2025-06-17 09:19)
1321

Docker/swarm/evolution_api_v2.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ services:
9494
- WEBHOOK_EVENTS_ERRORS_WEBHOOK=
9595
- CONFIG_SESSION_PHONE_CLIENT=Evolution API V2
9696
- CONFIG_SESSION_PHONE_NAME=Chrome
97-
#- CONFIG_SESSION_PHONE_VERSION=2.3000.1023204200
9897
- QRCODE_LIMIT=30
9998
- OPENAI_ENABLED=true
10099
- DIFY_ENABLED=true

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -549,17 +549,18 @@ export class BaileysStartupService extends ChannelStartupService {
549549
this.logger.info(`Browser: ${browser}`);
550550
}
551551

552-
let version;
553-
let log;
554-
555-
if (session.VERSION) {
556-
version = session.VERSION.split('.');
557-
log = `Baileys version env: ${version}`;
558-
} else {
559-
const baileysVersion = await fetchLatestWaWebVersion({});
560-
version = baileysVersion.version;
561-
log = `Baileys version: ${version}`;
562-
}
552+
const baileysVersion = await fetchLatestWaWebVersion({});
553+
const version = baileysVersion.version;
554+
const log = `Baileys version: ${version.join('.')}`;
555+
556+
// if (session.VERSION) {
557+
// version = session.VERSION.split('.');
558+
// log = `Baileys version env: ${version}`;
559+
// } else {
560+
// const baileysVersion = await fetchLatestWaWebVersion({});
561+
// version = baileysVersion.version;
562+
// log = `Baileys version: ${version}`;
563+
// }
563564

564565
this.logger.info(log);
565566

@@ -1059,6 +1060,8 @@ export class BaileysStartupService extends ChannelStartupService {
10591060
'failed to decrypt message',
10601061
'SessionError',
10611062
'Invalid PreKey ID',
1063+
'No session record',
1064+
'No session found to decrypt message',
10621065
].some((err) => param?.includes?.(err)),
10631066
)
10641067
) {
@@ -2559,7 +2562,9 @@ export class BaileysStartupService extends ChannelStartupService {
25592562
imageBuffer = Buffer.from(base64Data, 'base64');
25602563
} else {
25612564
const timestamp = new Date().getTime();
2562-
const url = `${image}?timestamp=${timestamp}`;
2565+
const parsedURL = new URL(image);
2566+
parsedURL.searchParams.set('timestamp', timestamp.toString());
2567+
const url = parsedURL.toString();
25632568

25642569
let config: any = { responseType: 'arraybuffer' };
25652570

@@ -2780,7 +2785,9 @@ export class BaileysStartupService extends ChannelStartupService {
27802785

27812786
if (isURL(audio)) {
27822787
const timestamp = new Date().getTime();
2783-
const url = `${audio}?timestamp=${timestamp}`;
2788+
const parsedURL = new URL(audio);
2789+
parsedURL.searchParams.set('timestamp', timestamp.toString());
2790+
const url = parsedURL.toString();
27842791

27852792
const config: any = { responseType: 'stream' };
27862793

@@ -3709,7 +3716,9 @@ export class BaileysStartupService extends ChannelStartupService {
37093716
let pic: WAMediaUpload;
37103717
if (isURL(picture)) {
37113718
const timestamp = new Date().getTime();
3712-
const url = `${picture}?timestamp=${timestamp}`;
3719+
const parsedURL = new URL(picture);
3720+
parsedURL.searchParams.set('timestamp', timestamp.toString());
3721+
const url = parsedURL.toString();
37133722

37143723
let config: any = { responseType: 'arraybuffer' };
37153724

@@ -4001,7 +4010,9 @@ export class BaileysStartupService extends ChannelStartupService {
40014010
let pic: WAMediaUpload;
40024011
if (isURL(picture.image)) {
40034012
const timestamp = new Date().getTime();
4004-
const url = `${picture.image}?timestamp=${timestamp}`;
4013+
const parsedURL = new URL(picture.image);
4014+
parsedURL.searchParams.set('timestamp', timestamp.toString());
4015+
const url = parsedURL.toString();
40054016

40064017
let config: any = { responseType: 'arraybuffer' };
40074018

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ export class ChatwootService {
681681
instance,
682682
body.key.participant.split('@')[0],
683683
filterInbox.id,
684-
isGroup,
684+
false,
685685
body.pushName,
686686
picture_url.profilePictureUrl || null,
687687
body.key.participant,

src/api/routes/index.router.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ router
6969
clientName: process.env.DATABASE_CONNECTION_CLIENT_NAME,
7070
manager: !serverConfig.DISABLE_MANAGER ? `${req.protocol}://${req.get('host')}/manager` : undefined,
7171
documentation: `https://doc.evolution-api.com`,
72-
whatsappWebVersion:
73-
process.env.CONFIG_SESSION_PHONE_VERSION || (await fetchLatestWaWebVersion({})).version.join('.'),
72+
whatsappWebVersion: (await fetchLatestWaWebVersion({})).version.join('.'),
7473
});
7574
})
7675
.post('/verify-creds', authGuard['apikey'], async (req, res) => {

src/config/env.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export type Webhook = {
249249
};
250250
};
251251
export type Pusher = { ENABLED: boolean; GLOBAL?: GlobalPusher; EVENTS: EventsPusher };
252-
export type ConfigSessionPhone = { CLIENT: string; NAME: string; VERSION: string };
252+
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
253253
export type QrCode = { LIMIT: number; COLOR: string };
254254
export type Typebot = { ENABLED: boolean; API_VERSION: string; SEND_MEDIA_BASE64: boolean };
255255
export type Chatwoot = {
@@ -590,7 +590,6 @@ export class ConfigService {
590590
CONFIG_SESSION_PHONE: {
591591
CLIENT: process.env?.CONFIG_SESSION_PHONE_CLIENT || 'Evolution API',
592592
NAME: process.env?.CONFIG_SESSION_PHONE_NAME || 'Chrome',
593-
VERSION: process.env?.CONFIG_SESSION_PHONE_VERSION || null,
594593
},
595594
QRCODE: {
596595
LIMIT: Number.parseInt(process.env.QRCODE_LIMIT) || 30,

0 commit comments

Comments
 (0)