Enable Authenticated Users
This provision allows you to sync the information of users who have logged in on your website with the Web chat widget.
- You can provide your unique customer IDs to authenticate anonymous users on the chat widget.
- These customer IDs can be set as the user IDs for the bot using the Login Function.
To start using Functions, you need to insert the Embed Script at the "footer" tag or the end of "/body" tag of your website.
You can find the Embed Script when you the visit the Web channel under Channels on your Gupshup Conversation Cloud.
Login Function
This Function sets the user ID for authenticating the user on the chat widget, thereby syncing the chat widget with the browser login.
The Login Function must be called every time the user logs in, refreshes, reloads, or reopens the browser.
window.gipMessengerPlugin.setUserId('YOUR_USER_ID')
Logout Function
This Function removes the user ID from local storage. If a logged in user (plus authenticated on the chat widget) logs out from your website, the Logout Function should be called.
- This will start a new session on the chat widget as a fresh anonymous user.
- This will hide their chat history (if enabled) from the chat widget until they log in on the website again and the Login Function is called.
window.gipMessengerPlugin.removeUserId()
Guidelines & Limitations
- If an anonymous user chats with the bot and then logs in on your website, their messages exchanged anonymously will not appear as chat history after they are authenticated on the chat widget.
- If a user authenticated on the chat widget closes the website and returns to the website again:
- If they are still logged in as per the website, the website must call the Login Function again to keep the user authenticated on the chat widget and fetch their chat history.
- If their logged in session has expired or timed out as per the website, the Logout Function must be caled by the website.
- If a logged in user (plus authenticated on the chat widget) clears their browsing history and cookies, there will be no impact on the authentication and the chat history.
- If a logged in user (plus authenticated on the chat widget) clears their browserβs local storage, they will be reverted back to an anonymous user and their chat history will be deleted from the chat widget.
Updated 3 months ago