Skip to content

Commit 1b93aac

Browse files
committed
fix: When conversation reopens is pending when conversation pending is true
1 parent 85ca068 commit 1b93aac

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 1.4.6 (homolog)
22

33
* Fixed bug of creating new inbox by chatwoot
4+
* When conversation reopens is pending when conversation pending is true
45

56
# 1.4.5 (2023-07-26 09:32)
67

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "evolution-api",
3-
"version": "1.4.5",
3+
"version": "1.4.6",
44
"description": "Rest api for communication with WhatsApp",
55
"main": "./dist/src/main.js",
66
"scripts": {

src/whatsapp/services/chatwoot.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,16 @@ export class ChatwootService {
507507
let conversation: any;
508508
if (this.provider.reopen_conversation) {
509509
conversation = contactConversations.payload.find((conversation) => conversation.inbox_id == filterInbox.id);
510+
511+
if (this.provider.conversation_pending) {
512+
await client.conversations.toggleStatus({
513+
accountId: this.provider.account_id,
514+
conversationId: conversation.id,
515+
data: {
516+
status: 'pending',
517+
},
518+
});
519+
}
510520
} else {
511521
conversation = contactConversations.payload.find(
512522
(conversation) => conversation.status !== 'resolved' && conversation.inbox_id == filterInbox.id,

src/whatsapp/services/whatsapp.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ export class WAStartupService {
695695
this.logger.verbose('Sending data to webhook in event STATUS_INSTANCE');
696696
this.sendDataWebhook(Events.STATUS_INSTANCE, {
697697
instance: this.instance.name,
698-
status: 'removed',
698+
status: 'closed',
699699
});
700700

701701
if (this.localChatwoot.enabled) {
@@ -704,7 +704,7 @@ export class WAStartupService {
704704
{ instanceName: this.instance.name },
705705
{
706706
instance: this.instance.name,
707-
status: 'removed',
707+
status: 'closed',
708708
},
709709
);
710710
}

0 commit comments

Comments
 (0)