intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 54 forks source link

Problems looking up on email #151

Closed morindune closed 4 years ago

morindune commented 5 years ago

Hi,

I have recently been testing out the library, and everything works fine when looking up on ID, however when trying to do a lookup on email (using the sample code) it only returns an empty object, tested with and with out url encoding and on different emails i know exists, doing a simple curl request on the same email works like a charm. Already talked to intercom support, and they suggested I should create an issue here.

Thank you :) Best Regards, Silje

lindeberg commented 5 years ago

I second this.

Intercom.Dotnet.Client 1.0.31

API version 1.2 (2019-05-03)

phil118 commented 5 years ago

Same here, I updated to latest version of Intercom API to double check and same results as @morindune, empty object but query via a simple curl request it all works ok.

Intercom.Dotnet.Client Version="2.1.0"

API version 1.3 (2019-06-05)

phil118 commented 5 years ago

It looks like its because the UsersClient tries to return a single user when the client requests to get a user by email, but now according the Intercom API docs it returns multiple users so the deserialization to the User object is failing and needs to be updated to return Users FirstOrDefault() or similar.

As a workaround until it gets fixed you can lookup users using the List endpoint which still works fine

Users users = client.List(new Dictionary<string, string>() { { "email", "email@example.com" } });

lindeberg commented 5 years ago

Thanks @phil118!

morindune commented 5 years ago

@phil118 Thank you for the tip on the workaround :D

lloydliyu commented 4 years ago

Hey @morindune :wave: As mentioned this is due to a change in how we handled searching by email in laster versions of the 1.x API. If you use Version 1.0 you should get a single returned user, however in later versions you get a list, which the SDK isn't expecting.

Related to: https://github.com/intercom/intercom-dotnet/issues/155

We don't have a timeline for the dotnet SDK to be updated to support more recent versions of our API yet. However, if anybody wants to give it a shot and add support, feel free to jump in and leave a note in this issue (https://github.com/intercom/intercom-dotnet/issues/163) issue so we are all aligned and we don't do double work 😃

We'll let you know here when we start working on it. In the meantime, if you need help changing your app version to 1.0 within the Developer hub, feel free to reach out to the support team using the Messenger on https://intercom.com who can help you with the steps on that.

Closing this out as there are over issues that cover this.