Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore chat history #6

Closed
alegeza opened this issue Feb 6, 2018 · 8 comments
Closed

Restore chat history #6

alegeza opened this issue Feb 6, 2018 · 8 comments

Comments

@alegeza
Copy link

alegeza commented Feb 6, 2018

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
Copy link
Owner

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

@alegeza
Copy link
Author

alegeza commented Feb 13, 2018

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
Copy link

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

@santosh-vishwakarma
Copy link

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
Copy link
Owner

We are looking into this and will keep you updated.

@techaffinity
Copy link
Owner

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

@alegeza
Copy link
Author

alegeza commented Feb 13, 2019

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

@alegeza alegeza closed this as completed Feb 13, 2019
@Shri7722
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants