mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-17 04:32:53 -06:00
Merge pull request #582 from deivisonrpg/hotfix-getOpenConversationByContact
fix(chatwoot): getOpenConversationByContact and init queries error
This commit is contained in:
commit
60a20f61af
@ -49,7 +49,7 @@
|
|||||||
"amqplib": "^0.10.3",
|
"amqplib": "^0.10.3",
|
||||||
"aws-sdk": "^2.1499.0",
|
"aws-sdk": "^2.1499.0",
|
||||||
"axios": "^1.6.5",
|
"axios": "^1.6.5",
|
||||||
"baileys": "^6.7.1",
|
"baileys": "^6.7.2",
|
||||||
"class-validator": "^0.14.1",
|
"class-validator": "^0.14.1",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
@ -789,26 +789,15 @@ export class ChatwootService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = [
|
const conversations = (await client.contacts.listConversations({
|
||||||
['inbox_id', inbox.id.toString()],
|
accountId: this.provider.account_id,
|
||||||
['contact_id', contact.id.toString()],
|
id: contact.id,
|
||||||
['status', 'open'],
|
})) as any;
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
(
|
conversations.payload.find(
|
||||||
(await client.conversations.filter({
|
(conversation) => conversation.inbox_id === inbox.id && conversation.status === 'open',
|
||||||
accountId: this.provider.account_id,
|
) || undefined
|
||||||
payload: payload.map((item, i, payload) => {
|
|
||||||
return {
|
|
||||||
attribute_key: item[0],
|
|
||||||
filter_operator: 'equal_to',
|
|
||||||
values: [item[1]],
|
|
||||||
query_operator: i < payload.length - 1 ? 'AND' : null,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
})) as { payload: conversation[] }
|
|
||||||
).payload[0] || undefined
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user