crisp-im / ruby-crisp-api

💎 Crisp API Ruby Wrapper
https://docs.crisp.chat/guides/rest-api/
MIT License
16 stars 7 forks source link

Search Query (& other params) in list_conversations #8

Closed mvaragnat closed 3 years ago

mvaragnat commented 4 years ago

First, thanks for the wonderful service - now I'd like to play with the backend API. I'd like to search conversations using the API. However, list_conversations only accepts page_number as input

I'd like to do

# get_client.website.list_conversations(ENV['CRISP_WEBSITE'], 1, { search_query: query } )

Instead, I have to do this :

 url = "https://api.crisp.chat/v1/website/#{ENV['CRISP_WEBSITE']}/conversations/1?search_query=#{query}"
results = RestClient::Request.execute(
          method: :get, 
          url: url, 
          user: ENV['CRISP_IDENTIFIER'], 
          password: ENV['CRISP_KEY'])
ap JSON.parse results

Am I missing something ?

This being said, perhaps the search is not implemented yet ? Because this call doesnt find any results. Which would explain why the ruby lib doesnt have it yet... I have attempted the same with curl, and get empty results as well :

curl -u identifier:key https://api.crisp.chat/v1/website/website_id/conversations/1?search_query=test&search_type=text

mvaragnat commented 4 years ago

I dont know if "search_query" is the right input, I want to find conversations more or less in the same way search works on the web UI