fix: When conversation reopens is pending when conversation pending is true

This commit is contained in:
Davidson Gomes 2023-07-26 17:33:31 -03:00
parent 85ca0683ed
commit 1b93aac8c5
4 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,7 @@
# 1.4.6 (homolog)
* Fixed bug of creating new inbox by chatwoot
* When conversation reopens is pending when conversation pending is true
# 1.4.5 (2023-07-26 09:32)

View File

@ -1,6 +1,6 @@
{
"name": "evolution-api",
"version": "1.4.5",
"version": "1.4.6",
"description": "Rest api for communication with WhatsApp",
"main": "./dist/src/main.js",
"scripts": {

View File

@ -507,6 +507,16 @@ export class ChatwootService {
let conversation: any;
if (this.provider.reopen_conversation) {
conversation = contactConversations.payload.find((conversation) => conversation.inbox_id == filterInbox.id);
if (this.provider.conversation_pending) {
await client.conversations.toggleStatus({
accountId: this.provider.account_id,
conversationId: conversation.id,
data: {
status: 'pending',
},
});
}
} else {
conversation = contactConversations.payload.find(
(conversation) => conversation.status !== 'resolved' && conversation.inbox_id == filterInbox.id,

View File

@ -695,7 +695,7 @@ export class WAStartupService {
this.logger.verbose('Sending data to webhook in event STATUS_INSTANCE');
this.sendDataWebhook(Events.STATUS_INSTANCE, {
instance: this.instance.name,
status: 'removed',
status: 'closed',
});
if (this.localChatwoot.enabled) {
@ -704,7 +704,7 @@ export class WAStartupService {
{ instanceName: this.instance.name },
{
instance: this.instance.name,
status: 'removed',
status: 'closed',
},
);
}