techaffinity / freshchat-phonegap

Freshchat sdk for phonegap
7 stars 36 forks source link

Restore chat history #6

Closed alegeza closed 5 years ago

alegeza commented 6 years ago

Hello,

I am using Apache Cordova plugin for Freshchat in Ionic 1 application. It is working fine, but I can't load the chat history.

I haven't found any functions to indetify user with restore id and external id. Could you tell me how to get the history of chat using the plugin?

Thanks

techaffinity commented 6 years ago

Currently We didn’t implement this feature in SDK, will be include this on Upcoming releases.

alegeza commented 6 years ago

Hello, thanks a lot for your response.

I have one more question if you don't mind.

I am trying to get restoreId. According to documentation

Restore Id - This is generated by Freshchat for the current user, given an external id was set and can be retrieved anytime using the Freshchat.getUser().getRestoreId() API. The app is responsible for storing and later present the combination of external id and restore id to the Freshchat SDK to continue the chat conversations across sessions on same device or across devices and platforms.

Here's the snippet:

let userInfo = {
           firstName: this.user.firstName,
           lastName: this.user.lastName,
           email: this.user.email
       };
window.Freshchat.updateUser(JSON.stringify(userInfo));
let userProperties = {
       user_id: this.user.id.toString(),
       created_at: this.user.dateCreated.toString(),
       organisation: this.user.organisation.name,
       organisation_id: this.user.organisation.id.toString()
};

let platform = window.device.platform;
//Android accepts JSON string, but iOS - dictionary
window.Freshchat.updateUserProperties(platform === 'Android' ? JSON.stringify(userProperties) : userProperties);
window.Freshchat.setExternalID(this.user.username);

Then I am trying to get restore id and Freshchat always returns nil for iOS and empty string for Android.

Could you hint me what is wrong?

danpillay87 commented 6 years ago

hi guys, any new on this in features or did you get this restoreId working?

santosh-vishwakarma commented 6 years ago

I was trying to get restore id bt using below code but it returns always undefined.

getRestoreId(){
        return (window as any).Freshchat.getRestoreID();
    }

    async asyncGetRestoreId(){
        return (window as any).Freshchat.getRestoreID();
    }

Please let me know if this approach is right or not or how I can get restore id or external id

techaffinity commented 5 years ago

We are looking into this and will keep you updated.

techaffinity commented 5 years ago

We have update the Restore Id listener. Please refer this README docs for restore chat history.

alegeza commented 5 years ago

thanks. It works on Android but on iOS I have as same result as described in this issue

Shri7722 commented 4 years ago

We have update the Restore Id listener. Please refer this README docs for restore chat history.

hey i find the restore id in freshchat how to finded