Answered

Conversation search API doesn't seem to be returning the expected data.

  • 26 February 2021
  • 3 replies
  • 92 views

Hello,

 

I have a user with conversations initiated by admins in our UI (with no user responses yet) as well as user-initiated conversations created via the Intercom API.

 

When I query the individual conversations, the user's contact ID is associated with each conversation, as I would expect.

 

When I query the `conversations/search` endpoint with a filter of `contact_ids = user_contact_id`, though, the only conversations returned are the ones initiated by the user.

 

Is that by design? I would expect that search for a conversation by contact_id would return ALL conversations that the user is associated with.

 

If I'm going about this the wrong way or more detail is needed, please let me know.

 

Thanks.

icon

Best answer by Roy 4 March 2021, 04:02

View original

3 replies

Userlevel 1

Hey @user929​, if you use the operator "=" with the contact_ids parameter, it will only return conversations that only include that contact_id and no others.

 

If you want to return all conversations that contain at least one instance of that contact_id, you'll need to use the operator "~".

 

You can read more about the operators that you can use with our API here.

Hey Eric, thanks for responding. Unfortunately, my problem seems to be unrelated to that. Apologies if my earlier post was unclear.

 

Like I mentioned, I have two types of conversations with a specific user: those initiated by our team via the Intercom UI and those initiated by the user and created via the API.

 

Both types of conversations include the correct contact_id – they are all associated with the specific user. When I retrieve each conversation via the `conversations/id` endpoint, I can clearly see that each conversation is associated with the user and that the conversation is marked as open.

 

Unfortunately, when I POST against `conversations/search` with the `contact_ids` value set to the relevant Intercom user id and the filter set to either `=` or `IN`, only the conversations initiated by the user and created via the API are returned. No conversations created by our team are returned.

 

The issue seems to be that conversations opened by our team aren't returned by the `conversations/search` endpoint despite being associated with the relevant `contact_id`

 

Setting the value to the Intercom user id and the filter to `~` doesn't seem to work, either.

 

If you have any further suggestions or need more information, let me know.

Userlevel 1
Badge

Hello @user929​ , I will jump into this conversation, You are right, this is how Intercom's API are working.

 

It's not possible to retrieve admin initiated conversations via search API.

To retrieve admin initiated conversations, best way will be to save Conversation Id's in database *During creation) and then retrieve via API:

https://api.intercom.io/conversations/ID

 

You can also get list of admin initiated conversations by using export API, more information can be found here.

Reply