intercom / intercom-ruby

Ruby bindings for the Intercom API
https://developers.intercom.io/reference
MIT License
277 stars 134 forks source link

`find_all` does not find multiple users with same email address #326

Closed m-o-e closed 6 years ago

m-o-e commented 7 years ago

Version info

Expected behavior

Return all users that match a given email address.

Actual behavior

Intercom::MultipleMatchingUsersError: Multiple existing users match this email address xx@example.com - must be more specific using user_id

Steps to reproduce

intercom.users.find_all(type: 'users', email:'xx@example.com').each_with_index { |u,i| p u }

Question

How to fetch all users that match a given email address without providing any additional information?

The intercom web-interface (search) can do it, but how is it done via the API? We don't know any userids, only the email address.

AGarrow commented 7 years ago

I'm having the same issue :/

KJTsanaktsidis commented 7 years ago

This is completely bananas - your data suddenly becomes unqueryable in this dimension as soon as you get a single dup in Intercom...

choran commented 7 years ago

Hi all, Yeah, this is a restriction at the moment with the API, i.e. it looks for a specific match so if you have multiple emails it will return the error. So it is not a restriction with the SDK as such. We are aware of this issue and thanks for bringing it up. It is frustrating given that you can identify duplicates via the web UI. We are trialling something internally to see if it resolves this issue to allow you search for users with multiple similar attributes such as email. I cannot provide an ETA at the moment but we if it works we will update the API which should resolve this issue. I will leave this issue open as it may be something other people want to comment on even for suggestions of how they would like it to work as well

rubendinho commented 7 years ago

Hi there - just wanted to see if there's an update to this? We are also seeing occasional duplicate records making it impossible to work with the API for those users.

davidlaprade commented 7 years ago

+1

dstotz commented 7 years ago

+1

choran commented 7 years ago

Hi @rubendinho .. at present we do not have an update on an ETA for this feature. Thanks for the feedback here, it helps us understand its impact and we are looking to see how and when we can address this. I will provide an update when I have more information on this.

m-o-e commented 7 years ago

Just want to add that we consider this a bug, not a feature. A portion of our users is inaccessible through the API.

choran commented 7 years ago

np, thanks for noting that. we do understand that this is a restriction for a number of use cases so we are tacking it as such, i.e. something that needs to be resolved.

a17levine commented 6 years ago

+1

choran commented 6 years ago

👍

jaGarcia commented 6 years ago

+1

choran commented 6 years ago

👍 thanks for this, unfortunately at the moment we do not have an update on this but the appreciate the feedback and hopefully we will get to this as soon as we can

molesky commented 6 years ago

+1

As a workaround, I am using users.scroll.each and comparing the email address to find the Intercom IDs to process. Gross.

rogerkerse commented 6 years ago

+1 Having the same problem

theandrewykim commented 6 years ago

Hey all - as a heads up, as Cathal mentioned - this issue is best served as a discussion for how this is being handled by you all. Since the behavior you're running into is a result of the behavior of the actual API (for which this repo is just a wrapper for) - your best bet would be to give feedback directly by writing into our messenger, or emailing team@intercom.io . We really do appreciate the feedback 👍

choran commented 6 years ago

As noted, this is an issue with the API which we will be addressing in the near future, it is on our short term plan. So I will close this issue as it is not an SDK issue and something we are addressing on our API. we can then look into if there is any issue once we make the change on the API

davidlaprade commented 5 years ago

Hey @choran it looks like the new version of the Intercom API (v1.1) has support for the feature that we have in mind here. I'm looking at the List By Email functionality.

You can list users by email to find all users with the same email address. [...] Returns a pageable list of users.

Do you plan to support the new version of the API any time soon? Would you be open to a PR that introduced this functionality?

Thanks!

jonnyom commented 5 years ago

Hey @davidlaprade great question. We'd be more than happy to look at any PR's that you'd like to submit.

The one caveat to this is that the SDK is API version agnostic, so that functionality will depend on a user by user basis depending on the API version they are using, so that would have to be kept in mind when adding the feature. Hope that makes sense :smile:

theandrewykim commented 5 years ago

Hey @davidlaprade - for now, you could even use the current Ruby SDK to get what you needed. You'll notice that the find all by email call in the API just requires some extra query params - so you should still be able to use find_all if you're using v1.1 of our API: intercom.users.find_all(type: 'users', email: email_address, page: 1, per_page: 10, created_since: 2, order: :asc)

davidlaprade commented 5 years ago

Ah, wonderful! Thanks @theandrewykim, @jonnyom

choran commented 5 years ago

Its a good point that we should have noted this in the README, I have updated with the example above and a note on the version change needed 👍