-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercom find
by external ID returns the same class with different data structures
#612
Comments
find
by external ID returns the same class with different interfacesfind
by external ID returns the same class with different data structures
I will just add an additional layer here. As it stands, it does not look like it is currently possible to practically use this gem to find an individual contact based on their external id. @Startouf raises an interesting point about the different responses, but those responses actually related to the company resource (not the contacts as suggested above). It looks like this has to do with subtle differences in the parameters needed and this is pretty easy to reproduce... 1. Create a Client3.2.1 :001 > client = ::Intercom::Client.new(
token: INTERCOM_TOKEN,
api_version: "2.11"
) 2. Finding an Individual Company (using
|
Version info
Expected behavior
It is not clear what the
intercom.contacts.find#
method does relatively to intercom v2 API.One would expect the method
contacts#find
to work when using external_ids just like the companies (which work using company_id):intercom.contacts.find(external_id: xxx)
. When using the library to find a user by its external ID, we're hoping to find a single user. In case of multiple users with the same external ID (is it possible in Intercom ?), the response should either throw an error (multiple matching user error) or return, to avoid confusion, a different class (like Intercom::ContactSearch or ContactList). When looking at the official REST API, the GET User endpoint seems to work only with intercom user IDs, but one could expect the Ruby gem to provide an abstraction to find users by external IDs as well.I would have rather have a
contacts.find_all
method when searching for users using the search contact POST so the expected output would be an iterable list.Is this some weird behavior introduced when migrating from v1 to v2 of the Intercom API ?
Actual behavior
The responses using
contacts.find(id: xxx)
andcontacts.find(external_id: xxx)
give two different data structures, yet they are of the same class (see example below in steps to reproduce)Steps to reproduce
Here is an example where a call to the API returns 10 different users (they all have different external_id, but for some reason the call returns them all), and the response class is
Intercom::Contact
which is misleading, because it actually contains several usersHere is the same call retuning only one user as mentioned in the documentation
Logs
The text was updated successfully, but these errors were encountered: