In accurate Results on Post Request conversation/search

Hi There,

I’m testing out the conversations/search endpoint on Postman. I wanted to review the response data before developing an app and have run into a snag.

Query Details are as follows:

POST to https://api.intercom.io/conversations/search
Authorization set to Bearer Token with the appropriate 60-character string
Headers:
Accept: application/json
Intercom-Version: 2.0
Content-Type: application/json

Body:

{
 "query":  {
    "operator": "AND",
    "value": [
      {
        "field": "source.author.email",
        "operator": "=",
        "value": "support@simpletexting.net"
      }, 
      {
        "field": "open",
        "operator": "=",
        "value": true
      }
    ]
  }
}

The response returned is as follows:

{
    "type": "conversation.list",
    "pages": {
        "type": "pages",
        "page": 1,
        "per_page": 150,
        "total_pages": 0
    },
    "total_count": 0,
    "conversations": []
}

The response suggests that we have no open conversations from that email, however, looking at our inbox I know this is not true.

Am I not understanding the query correctly? I am attempting to look for all open conversations from our email support@simpletexting.net.

Any guidance or assistance would be appreciated.

Hey @Sean_Mc_Ternan :wave:

I believe the issue here is because if this is a contact, the contact object within the author object of the source object (see the Conversation Model for more) has no email. It only has a type and the Intercom-given id of the contact. Can you try with source.author.id and see if it works?

1 Like

Thanks Zach. My apologies, I didn’t receive a notification that you had replied. I had applied the fix as you suggested and it does indeed work.

I did understand the search parameters must be available within the Source object. In another conversation You mentioned that changes in state can affect the pagination. For this reason I wanted to refine my search even further prevent state changes between requests. The conversations I am looking for (and subsequently calling your api to close) contain a users email address in the email body. When I attempted to use the source.body query, I’m met with an error “source.body is not a valid search field”. What would cause this error?

{
“query”: {
“operator”: “AND”,
“value”: [
{
“field”: “source.author.id”,
“operator”: “=”,
“value”: “5e****127"
},
{
“field”: “source.subject”,
“operator”: “~”,
“value”: “compliance”
},
{
“field”: “source.body”,
“operator”: “~”,
“value”: "s
@simpletexting.net
},
{
“field”: “open”,
“operator”: “=”,
“value”: true
}
]
}

}

@zach Unsure how this forum works, however, I never tagged you in my follow up question. ^

@zach - Just touching base on the above request. The source.body param does not appear to be pulling any results.

{
“field”: “source.body”,
“operator”: “~”,
“value”: "s
@simpletexting.net
},