issue with filterDateStart and filterDateEnd
spidIslem opened this issue · 3 comments
the API list conversations with search is not reachebal from my code when using filter by date. The issue is related to time value when i omit it and work whith just date it works
Hey there, could you please post a snippet of your code + the you're expecting and the results you actually have?
Ok the thing is that there is no "search" in your request. You're basically searching for nothing.
You must provide a searchQuery
and searchType
when using this method (remember, it's called findWithSearch 😉).
Otherwise, the query will search for nothing and will ignore all filters as well (that's why your date filters are ignored).
For example, this code will return valid results:
CrispClient.websiteConversations.findWithSearch(websiteId, 0, {
filterDateStart: "2021-09-11T07:50:14.395Z",
filterDateEnd: "2021-09-29T07:50:14.395Z",
searchQuery: "test",
searchType: "text"
})
.then((result) => {
result.forEach(conversation => {
console.log(conversation.session_id + " " + new Date(conversation.created_at));
});
})
.catch(err => {
console.log(err);
});
Please have a look at the API reference for more information: https://docs.crisp.chat/api/v1/#website-website-conversations