You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation is misleading regarding how to find a User by email.
Version info
intercom-java version: 2.8.0
Java version: 8
Expected behavior
According to the documentation, User.find(ImmutableMap.of("email", someEmail)) should return data for an existing User, or null if no User is found, in the same way as User.find(ImmutableMap.of("user_id", someId)) does.
Actual behavior
User.find(ImmutableMap.of("email", someEmail)) returns a User object containing no data. When debugging, we can observe the the result returned by the API is a collection of users rather than a single user, and that the attempt made by the library to map this collection onto a User.class logically fails.
Workaround for the impatient
UserCollectionresult = User.list(ImmutableMap.of("email", userEmail));
List<User> page = result.getPage();
if (page.size() > 1) {
log.warn("Several users found for email {}", userEmail);
}
Useruser = page.isEmpty() ? null : page.get(0);
// do something with user
I thank you in advance if you can find some time to fix either the library or the documentation.
Regards,
Nicolas
The text was updated successfully, but these errors were encountered:
I pinged Intercom about this specific issue - they confirmed to me that the SDK (and API) don't work as advertised. The API behaviour is correct, and the SDK/documentation needs to be updated to remove this. The workaround they suggested to me was to the same as Nicolas'.
Hi Intercom team!
The documentation is misleading regarding how to find a User by email.
Version info
Expected behavior
According to the documentation,
User.find(ImmutableMap.of("email", someEmail))
should return data for an existing User, ornull
if no User is found, in the same way asUser.find(ImmutableMap.of("user_id", someId))
does.Actual behavior
User.find(ImmutableMap.of("email", someEmail))
returns a User object containing no data. When debugging, we can observe the the result returned by the API is a collection of users rather than a single user, and that the attempt made by the library to map this collection onto a User.class logically fails.Workaround for the impatient
I thank you in advance if you can find some time to fix either the library or the documentation.
Regards,
Nicolas
The text was updated successfully, but these errors were encountered: