I am using react-native-freshchat-sdk. After initiating freshchat with freshchatConfig, I have called Frestchat.setUser(user) and Freshchat.identifyUser(externalId, restoreId). Then I am calling Freshchat.getUser(callback). But in the callback, I am not getting user details. I have atteched my code below:
let freshchatUser = new FreshchatUser();
freshchatUser = {
...freshchatUser,
firstName: user_name,
email: email_address,
phoneCountryCode: PHONE_CODE,
phone: phone_number,
};
Freshchat.setUser(freshchatUser);
Freshchat.identifyUser(user_uid, chat_id || null, () => { }); // user_uid as externalId and chat_id as restoreId
Freshchat.getUser((user) => {
const restoreId = user.restoreId;
if (!restoreId && !chat_id) {
Freshchat.getFreshchatUserId((data) => {
const users = { ...userInfo, chat_id: data };
setLSItems('userData', JSON.stringify(users));
// BE API Call to update restore id
});
}
});