Skip to content

Commit 7cacf7b

Browse files
committed
fix: Bug fix when connecting whatsapp does not send confirmation message
1 parent 44bf39f commit 7cacf7b

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Fixed problem to receive csat in chatwoot
2424
* Fixed require fileName for document only in base64 for send media message
2525
* Bug fix when sending mobile message change contact name to number in chatwoot
26+
* Bug fix when connecting whatsapp does not send confirmation message
2627

2728
# 1.2.2 (2023-07-15 09:36)
2829

src/whatsapp/services/chatwoot.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,8 @@ export class ChatwootService {
14571457

14581458
if (event === 'connection.update') {
14591459
this.logger.verbose('event connection.update');
1460-
if (body.state === 'open') {
1460+
console.log('connection.update', body);
1461+
if (body.status === 'open') {
14611462
const msgConnection = `🚀 Conexão realizada com sucesso!`;
14621463

14631464
this.logger.verbose('send message to chatwoot');

src/whatsapp/services/whatsapp.service.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,17 @@ export class WAStartupService {
624624
│ CONNECTED TO WHATSAPP │
625625
└──────────────────────────────┘`.replace(/^ +/gm, ' '),
626626
);
627+
628+
if (this.localChatwoot.enabled) {
629+
this.chatwootService.eventWhatsapp(
630+
Events.CONNECTION_UPDATE,
631+
{ instanceName: this.instance.name },
632+
{
633+
instance: this.instance.name,
634+
status: 'open',
635+
},
636+
);
637+
}
627638
}
628639
}
629640

0 commit comments

Comments
 (0)