Answered

Is `source.url` in conversations searchable with non-trivial string operators?

  • 15 July 2021
  • 4 replies
  • 78 views

I am trying to search `source.url` using the contains ("~") or starts with ("^") operators to filter to a specific domain, and am getting no results. When I search using equals ("="), results are returned but that isn't viable as the URLs may change. For example:

curl -X POST \
--data '{ "query": { "field": "source.url", "operator": "~", "value": "test.com" }}' \
-H 'Authorization: Bearer XXXX' \
-H 'Accept: application/json' \
-H 'Intercom-Version: 2.3' \
-H 'Content-Type: application/json' \
'https://api.intercom.io/conversations/search#39;
 
{"type":"conversation.list","pages":{"type":"pages","page":1,"per_page":150,"total_pages":0},"total_count":0,"conversations":[]}
 
curl -X POST \
--data '{ "query": { "field": "source.url", "operator": "^", "value": "https://www.test.comquot; }}' \
-H 'Authorization: Bearer XXXX' \
-H 'Accept: application/json' \
-H 'Intercom-Version: 2.3' \
-H 'Content-Type: application/json' \
'https://api.intercom.io/conversations/search#39;
 
{"type":"conversation.list","pages":{"type":"pages","page":1,"per_page":150,"total_pages":0},"total_count":0,"conversations":[]}
 
curl -X POST \
--data '{ "query": { "field": "source.url", "operator": "=", "value": "https://www.test.com/specific/urlquot; }}' \
-H 'Authorization: Bearer XXXX' \
-H 'Accept: application/json' \
-H 'Intercom-Version: 2.3' \
-H 'Content-Type: application/json' \
'https://api.intercom.io/conversations/search#39;
 
{"type":"conversation.list","pages":{"type":"pages","page":1,"per_page":150,"total_pages":1},"total_count":1,"conversations": ... }}

The above examples have been made generic and API tokens removed, however the results are from when I run them using our own data. As an addendum, string searches using other fields, like "source.author.name", "~", "Vince", do return results.

 

Is there a way to search using my original query, or should I download all conversations and filter after the fact?

 

Thanks in advance!

icon

Best answer by Eric Fitz 22 July 2021, 15:48

View original

4 replies

Userlevel 1

Hey @roy s11​, you're someone who knows a lot about our API, do you reckon you'd be able to help @vince​ here?

Userlevel 1

Hey @vince​, I checked in with our support engineers, and they've advised me that the best way to achieve what you're looking to do is to download all conversations and filter after the fact, as you suggested.

Thanks! I appreciate you taking the time.

I have the same problem, as the docs say, filtering using ~ or ^ is possible because source.url is a string but no results are retrieved, please fix this.

Reply