Skip to main content

I'm trying to search my Contacts by their `id` using the `IN` operator that is listed in API v2.3 reference (https://developers.intercom.com/intercom-api-reference/reference#section-accepted-operators

This is my current request payload:

```json

{

"query": {

"operator": "OR",

"value": [

{

"field": "id",

"operator": "IN",

"value": ["5fec4b003ba34a1198516369","5fec4b003ba34a11ab516481"]

}

]

}

}

```

 

but I get back an invalid response

```json

{

"type": "error.list",

"request_id": "000bcmd8o18tsjg9qfq0",

"errors":

{

"code": "invalid_field",

"message": "_id is not a valid search field"

}

]

}

```

It looks like that this field can't be used to search with the IN operator (this request works if I use `email` field, for example) despite what is written in the "Accepted Fields" chapter (https://developers.intercom.com/intercom-api-reference/reference#section-accepted-fields

 

If I try to search by ID with other operators (like a long list of OR conditions) it works.

```json

{

"query": {

"operator": "OR",

"value": :

{

"field": "id",

"operator": "=",

"value": "5fec4b003ba34a1198516369"

},

{

"field": "id",

"operator": "=",

"value": "5fec4b003ba34a11ab516481"

},

p...]

```

 

Also the limitation

> There’s a limit of max 15 filters for each AND or OR group

means that, even with the IN operator, we cannot search for more than 15 users (emails) at a time?

 

Thanks!

Hey @rubens​, this is a known issue on our end. I've added your report to the bug report on our end, and I'll let you know once it's resolved.


Thanks Eric, really appreciate!


@eric f11​ Is there any movement on this? I've discovered the same problem but with "external_id", which returns a "user_id is not a valid search field" error message.


Hi @dan a11​ 👋, Can you post a request? I will be happy to take a look 😇


{

"query": {

"operator": "OR",

"value": [{

"field": "external_id",

"operator": "IN",

"value": ["someIdValueHere","anotherIdValueHere"]

}]

}

}

Thanks, @roy s11​ .

I think it's almost exactly the same as OP's - except referring to "external_id" instead of "id".

Error message is "user_id is not a valid search field" - which I assume is a hangover from when that field was called user_id?


@eric f11​ - Any movement at all?


Hey @roy s11​, I know you're very busy, but did you ever get a chance to look at @dan a11​'s sample request?


Hello @dan a11​ ,

 

Upon checking you are right it's not possible to use the "external_id" parameter to search users.

 

You can store Interom id's in your database and retrieve contacts via Intercom IDs - Just use retrieve contact API.


Just to confirm - based on OP's post (searching by Intercom ID) and my subsequent query (searching by external_id), there's no way to search for contacts using the IN syntax with either their Intercom ID or an external ID at all?

 

Changing my database schema, migrating Intercom data into that new column, and then making separate calls per contact to the "retrieve contact" API seems a little heavy handed to do something that seems like it should just work...


Reply