Hello everyone!
I would like to filter threads using a search as described here: Nylas v3 Email, Calendar, and Contacts API docs | Nylas Docs
My use case is that a user will type their search string and this will be used to find the threads that either contain this in their subject or there is an email associated with that search string in the thread. After that the threads shall be returned from last to first.
I see I can use the columns “subject” and “any_email” which would serve my purpose quite well but there is not an option for a logical OR between the two. I can see that the ordering is by default that the latest thread should come first so in that aspect everything is ok.
I could see one solution being that I could make 2 separate requests in the same API, one with “subject” and another with “any_email” but there is an issue there in both ordering of the eventual response data and pagination.
Another solution I have considered for this is to use search_query_native
and do something like the following: (I am using Microsoft provider)
filter_query = (
f"$filter=contains(subject,‘{search_string}’) or "
f"contains(from/emailAddress/address,‘{search_string}’)"
)
The problem with the above solution however is that results do not come ordered by latest date, and I can not seem to find a way to order them.
Any ideas?
Thanks a lot in advance