I am trying to search in conversations but using your example: I get a 400 "Query body must contain a query hash". When using contact search everything works fine | Community
Skip to main content
Answered

I am trying to search in conversations but using your example: I get a 400 "Query body must contain a query hash". When using contact search everything works fine

  • February 22, 2021
  • 7 replies
  • 783 views

I am trying to search in conversations but using your example: I get a 400 "Query body must contain a query hash". When using contact search everything works fine

Best answer by Roy

@user919​ , I just tested this out, it's working fine from me. Can you confirm that you are sending JSON request from Postman?

(I think there some problems with your Postman configuration).

7 replies

Roy
Top Expert ✨
Forum|alt.badge.img+5
  • Top Expert ✨
  • 1152 replies
  • February 24, 2021

Hello @user919​ , Can you post the full API request?


  • Author
  • New Participant
  • 3 replies
  • March 3, 2021

Hi,

 

we call https://api.intercom.io/conversations/search/p>

with body params:

{

 "query": {

  "field": "contact_ids",

  "operator": "=",

  "value": "600bfa5ff56b2ea78672f2d0"

 }

 

}


Roy
Top Expert ✨
Forum|alt.badge.img+5
  • Top Expert ✨
  • 1152 replies
  • Answer
  • March 4, 2021

@user919​ , I just tested this out, it's working fine from me. Can you confirm that you are sending JSON request from Postman?

(I think there some problems with your Postman configuration).


  • Author
  • New Participant
  • 3 replies
  • March 4, 2021

Yes, I confirm that.

I am using postman. This API https://developers.intercom.com/intercom-api-reference/reference#search-for-conversations/p>

  • with Bearer Token: <mytoken>
  • with header Accept: Application/json

with body: {

 "query": {

  "field": "contact_ids",

  "operator": "=",

  "value": "600bfa5ff56b2ea78672f2d0"

 }

}

 

But we still get 400 Bad request and response:

{

    "type": "error.list",

    "request_id": "001do3dkinhl2i45r9dg",

    "errors": [

        {

            "code": "invalid_query",

            "message": "Query body must contain a query hash"

        }

    ]

}

 

Any hint?


Roy
Top Expert ✨
Forum|alt.badge.img+5
  • Top Expert ✨
  • 1152 replies
  • March 5, 2021

@user919​ , Sorry for the late reply here, Sending you some Postman Configuration screenshots:

Body:

Intercom-APIHeaders:

Intercom-API2Can you change the configuration like this and try once again to send the request?

 

Looking forward.


  • Author
  • New Participant
  • 3 replies
  • March 22, 2021

Thank you very much.

It seems that Content-Type: application/json fixed the issue for us.

 

Thanks again,

Apostolis


Roy
Top Expert ✨
Forum|alt.badge.img+5
  • Top Expert ✨
  • 1152 replies
  • March 22, 2021

@user919​ , 🙌 Anytime, Always happy to help.

 

🦄 Have a great day.