flutter_freshchat icon indicating copy to clipboard operation
flutter_freshchat copied to clipboard

await FlutterFreshchat.identifyUser() is returning empty string when restoreId is not passed

Open daadu opened this issue 6 years ago • 18 comments

await FlutterFreshchat.identifyUser(
    externalID: accountId,
    restoreID: null,
  );

returns an empty string every time instead of restoreId generated by Freshchat.

PS: I am using the free plan of FreshChat

daadu avatar Jul 25 '19 00:07 daadu

This was tested on Android

daadu avatar Jul 25 '19 00:07 daadu

@daadu try passing an empty string rather than null to restoreId

fayeed avatar Jul 25 '19 05:07 fayeed

Strange. The Activity gets killed or something at times. Anyways, still, the same issue returning an empty string.

daadu avatar Jul 25 '19 05:07 daadu

@daadu I looked through the issue it doesn't generate a restoreId unless you start a conversation after that if you identify the user you should get a restoreId. I think this has to with Freshchat, not with this plugin as it is stated in the Freshchat Android docs: "Restore Id for a user is typically generated only when the user has sent a message."

fayeed avatar Jul 25 '19 07:07 fayeed

Also, you can pass null to the identifyUser method that should work too.

fayeed avatar Jul 25 '19 07:07 fayeed

Strange! anyways I will implement that way and test.Till then keep this issue open.

daadu avatar Jul 25 '19 07:07 daadu

In my current flow, I identify -> then add user detail -> then start conversation. I guess I should add user detail -> then start conversation -> then identify.

daadu avatar Jul 25 '19 07:07 daadu

This will also wont work if you are trying to sync conversations so I think the best way would be to check if the user has a restoreId stored locally or the server if he has identify the user or if not start the conversation and then identify.

fayeed avatar Jul 25 '19 08:07 fayeed

@daadu going to close this issue if the problem persists feel free to open the issue again

fayeed avatar Jul 30 '19 05:07 fayeed

@fayeed Not working. Sorry for responding late.

Empty string returned by FlutterFreshchat.identifyUser even after a conversation is initiated and responded.

daadu avatar Nov 03 '19 10:11 daadu

I have re-opened this issue again but I don't have time to work on it if you can fix this please do create a pull request or wait till someone else or I fix this.

fayeed avatar Nov 08 '19 17:11 fayeed

@daadu I just checked this issue I see no problem, It might be because you also need to update the user info.

Here I tested it and its working: Simulator Screen Shot - iPhone 11 Pro Max - 2019-11-13 at 21 39 17

fayeed avatar Nov 13 '19 16:11 fayeed

getting an empty string from identifyUser for my credentials. My freshchat account is on the free plan (not trial). I am guessing the issue could be related to this.

daadu avatar Dec 09 '19 06:12 daadu

I am also facing the same issue...did you find a fix?

deebhasin avatar Feb 06 '20 15:02 deebhasin

No, it looks like the issue because of free plan. Although not sure.

daadu avatar Feb 07 '20 08:02 daadu

As per docs. Restore Id is asynchronous and typically only initiated when conversion starts for first time. So as per their sample app and docs. We have to create Broadcast receiver on android so when it's created for first time. It will be passed by broadcast receiver. (I'm not sure of ios though) And then from native android we can call a flutter method which will give restore id when it becomes available.

rahuldange09 avatar Jun 23 '20 05:06 rahuldange09

by changing restoreId == "" to restoreId.equals("") in FlutterFreshchatPlugin in android module, empty restoreId issue will be resolved

ashim-ux avatar Nov 02 '20 06:11 ashim-ux

by changing restoreId == "" to restoreId.equals("") in FlutterFreshchatPlugin in android module, empty restoreId issue will be resolved

How about iOS?? I am having issues with the FlutterFreshchat.identifyUser. Prints this error Could not cast value of type 'NSNull' (0x7fff86b92b38) to 'NSString' (0x7fff86bb7bb0). And crashes when it tries to identify user. What values do I use for externalID and restoreID to prevent crash..

phil10xs avatar Jan 14 '21 12:01 phil10xs