mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 03:56:54 -06:00
Update chatwoot.service.ts
hotfix: bug on chatwoot sdk
This commit is contained in:
parent
7dacd752d3
commit
f41f3aaba8
@ -388,9 +388,17 @@ export class ChatwootService {
|
||||
q: query,
|
||||
});
|
||||
} else {
|
||||
contact = await client.contacts.filter({
|
||||
accountId: this.provider.account_id,
|
||||
// contact = await client.contacts.filter({
|
||||
// accountId: this.provider.account_id,
|
||||
// payload: this.getFilterPayload(query),
|
||||
// });
|
||||
// hotfix for: https://github.com/EvolutionAPI/evolution-api/pull/382. waiting fix: https://github.com/figurolatam/chatwoot-sdk/pull/7
|
||||
contact = await chatwootRequest(this.getClientCwConfig(), {
|
||||
method: 'POST',
|
||||
url: `/api/v1/accounts/${this.provider.account_id}/contacts/filter`,
|
||||
body: {
|
||||
payload: this.getFilterPayload(query),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -444,16 +452,16 @@ export class ChatwootService {
|
||||
|
||||
private getFilterPayload(query: string) {
|
||||
const payload = [];
|
||||
const values = this.getNumbers(query)
|
||||
const values = this.getNumbers(query);
|
||||
|
||||
const fields = this.getSearchableFields();
|
||||
fields.forEach((key, index) => {
|
||||
const queryOperator = fields.length - 1 === index ? null : 'OR';
|
||||
payload.push({
|
||||
"attribute_key": key,
|
||||
"filter_operator": "contains",
|
||||
"values": values,
|
||||
"query_operator": queryOperator
|
||||
attribute_key: key,
|
||||
filter_operator: 'contains',
|
||||
values: values,
|
||||
query_operator: queryOperator,
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user