Skip to main content
Answered

Can't search in contacts via API


I am trying this code:

$intercom = new \Intercom\IntercomClient($secretKey);

$intercom->contacts->search([

"query" => $['field' => 'name', 'operator' => '!=', 'value' => 'Alice'],

]);

 

As I understood: "name != Alice" should return all my contacts.

But as result I have exception: Not Found (404) in php-http/client-common/src/Plugin/ErrorPlugin.php line 83

 

What I do wrong?

Best answer by Team V11

For anyone who came across this, it might be that your App's corresponding API version does not match.

 

How to fix:

  1. go to Settings -> Developers -> Developer Hub
  2. Click your app -> Configure -> Basic Information and use 'change version' in API version section

 

Note be aware if you are already using the App's current API version though, since they are not backward compatitable

View original
Did this topic help you find an answer to your question?

12 replies

Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • September 17, 2020

Hey there @user327​, if you want to return a list of all your contacts through our API, you should use this call:

 

$ curl https://api.intercom.io/contacts\

-H 'Authorization:Bearer <Your access token>' \

-H 'Accept:application/json'


  • New Participant
  • 2 replies
  • September 29, 2020

@eric f11​ Having pretty same problem here, trying to use contact search API, and getting not_found error code in the response, no matter what I'm sending.

Example request:

 

curl --location --request POST 'https://api.intercom.io/contacts/search#39; \

--header 'Accept: application/json' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer <my access token>' \

--data-raw '{

 "query": {

  "field": "id",

  "operator": "~",

  "value": "5dbb136fc4de57aec70116bb"

 }

}'


Forum|alt.badge.img+5
  • Expert User
  • 1152 replies
  • September 30, 2020

Hello @yurii m11​, If you have a contact ID, Why just not use "Retrieve a contact"?

 

$ curl https://api.intercom.io/contacts/lt;id> \

-H 'Authorization:Bearer <Your access token>' \

-H 'Accept:application/json'

 

 


  • New Participant
  • 2 replies
  • October 6, 2020

Hi @roy s11​ 

I've used request body with id query just as an example.

In real case I will need to search by custom attribute value. So that my request would look like this:

 

curl --location --request POST 'https://api.intercom.io/contacts/search' \

--header 'Accept: application/json' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer <my access token>' \

--data-raw '{

 "query": {

  "field": "custom_attributes.my_attribute",

  "operator": "=",

  "value": "certainValue"

 }

}'

 

So simple ID queries don't fit my needs.


  • New Participant
  • 1 reply
  • Answer
  • March 8, 2021

For anyone who came across this, it might be that your App's corresponding API version does not match.

 

How to fix:

  1. go to Settings -> Developers -> Developer Hub
  2. Click your app -> Configure -> Basic Information and use 'change version' in API version section

 

Note be aware if you are already using the App's current API version though, since they are not backward compatitable


  • New Participant
  • 2 replies
  • March 27, 2021

I got the same issue here. @eric f11​ 

And my error looks like this: {'errors': [{'code': 'not_found',

'message': 'The requested resource does not exist; check your path and try again'}],

'type': 'error.list'}

Any help would be really appreciated.


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • March 29, 2021

Hey @nora l​, as per @team v11​'s response, is the API version you're calling the same one as used by your app?


  • New Participant
  • 2 replies
  • March 29, 2021

Thanks for the answer. It's working well now.


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • March 29, 2021

I'm glad to hear it!


  • New Participant
  • 1 reply
  • April 13, 2021

@eric f11​ 

I need a help

When I use the API I am getting the list of leads.

But I need list of users,

  • How can I access list of all users ?
  • How can I keep filters on the list of users like last seen

 

 


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • April 13, 2021

Hey @ankit c​, as this is a different question to the one asked in this thread, can I ask that you open a new question for it, please?


  • New Participant
  • 1 reply
  • August 27, 2022

Could you please explain what do you mean? I'm using version 2.3 (as I can see in developer-hub and still getting not found error: The requested resource does not exist; check your path and try again

UPD: Ok, I found it. Access token is bound to the specific application and its version must be up to date.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings