Question

Is it possible to update a user only if the user exists?

  • 5 January 2023
  • 1 reply
  • 173 views

I noticed that the Intercom update user API creates a new user whenever I call the `user update` with a non-existing user. And this is a behavior I do not want.

I found a workaround on the server side. Using the intercom-client Node library, I first try to fetch the user with the external id using the `users.find` endpoint. And if the user is found, I only then update the user.

However, on the client side, I am using the Intercom JavaScript API, and it seems that I cannot go with the same approach above as there is no `get user` option. So, what would be a good solution to only update the existing users and not create new ones on the client side? 👀


1 reply

Userlevel 2

Hey @nilay​! Daniel from Customer Support Engineering here 🔧 

 

The best bet here would be to use your REST API on the frontend to check if the user exists like you are doing on the server end. There is no way to check if the user already exists via the JS API. You might find sending a curl request with our REST API to be the best bet here!

Reply