Skip to main content

I am tying to query conversations (via python) and my payload is as follows

 

payload = {
  "query": {
    "operator": "AND",
    "value": l
        {
          "field": "state",
          "operator": "=",
          "value": "open"
        },
        {
          "field": "admin_assignee_id",
          "operator": "=",
          "value": "123456"
        },
        {
          "field": "waiting_since",
          "operator": "<",
          "value": 1693564392
        }
      ]
  }
}

 

The above logic should be, show me conversations where state = open AND admin_assignee_id = 123456 AND waiting since is less than 1693564392. 

The response however includes conversations that have a “state” = “closed”

 

What am I doing wrong ? Your docs state AND operators can have upto 15 filters.  

Hey there @Gary Cahill !

 

That call should only be returning open conversations. Are you sure that the conversation was actually open when you made the call and that it didn’t get closed at some point afterward? We do also have a Boolean attribute on that Conversation Object called ‘open’. If you continue to have issues around that ‘state’ attribute you could try the ‘open’ attribute.

 

If you double check that call and are still seeing it return closed conversations, you should write into our Support team in your Intercom Messenger. They can take a closer look at the specific conversations and see if there’s a rhyme or reason to the behavior that you’re seeing!


Hi @Jacob Cox 

I figured it out, it was actually the “waiting_since” field that was breaking my logic. I didnt share my full query as I was trying to simplify it for the question. 

When “waiting_since” was null, it was breaking. The reason being I had “” to check for null but I actually needed to use a null object. Where as checking string variables for nulls uses empty quotes and not a null object. I think this should be made more clear in the docs. 


Valid: 

{
          "field": "admin_assignee_id",
          "operator": "=",
          "value": ""
},

{
         "field": "waiting_since",
         "operator": "=",
         "value": null
 }

 

Invalid: 

{
          "field": "admin_assignee_id",
          "operator": "=",
          "value": ""
},

{
         "field": "waiting_since",
         "operator": "=",
         "value": “”
 }

 

(*I am using Python and declared null = None)


Reply