This is a step by step guidance on how to ensure the User accounts are in sync when embedding Ethora into your existing / legacy system which already has its own users authentication mechanism.
Such implementation ensures smooth experience for your end Users whereby they use Ethora features as part of your system without additional login or authentication steps required.
USERS SYNC
Implementation stage
Register an account at Ethora.com website and create your App
Copy your App ID and App Secret
Implement in your existing backend the procedure of generating JWT tokens with your Ethora App ID and App Secret.
Implement in your existing backend the procedure of User Create and User Delete via Ethora (DP) API. This will ensure each User in your system automatically has an Ethora platform account.
Implement in your existing backend the login procedure. User logs into your existing system, an Ethora JWT is generated by your backend with identification payload e.g. {email: "dwight.schrute@acme.com", type: "client", appId: "123"}) including User's e-mail and your Ethora App ID. This JWT will be signed with your Ethora App Secret. Your backend then passes this JWT into your frontend. Your frontend, in turn, passes it into the embedded Ethora Chat Component (or other Ethora component integrated into your system). Ethora component verifies whether your JWT is valid for your App ID (token.payload.appId). If so, Ethora component authenticates the User with the given e-mail (token.payload.email).
Kick-off preparation
Test the above mechanisms in both Dev/QA and Prod environments along with the general functioning of your system with Ethora component embedded.
As you test creating, logging in and deleting the Users, log into your Ethora server admin panel and check that User accounts are created and deleted correctly to replicate the status in your system.
Clean the Prod environment if needed.
Use Ethora import-users API to import all of the prior existing Users accounts into Ethora server. Note: Your User Create and User Delete procedures will take care of synchronising Users going forward, but you still need to ensure both your existing system and Ethora server have the same list of Users at the start.
Launch
Launch the implementation in your system into Prod.
(OPTIONAL) CHAT ROOMS SYNC
You might want to tie Ethora-powered chat rooms to certain entities in your system.
Your system will know which chat room to display to the User depending on certain business logic of your system.
For example, chat room could be related to a certain communication between your team member and a client. This communication can be linked to a certain order, support ticket or case. Alternatively, there could be certain 'space' where a group of your users have access, and there is going to be a chat room for that space. Such as a workspace for a team collaborating on something, a game location etc. In such case you are going to have a certain unique entity ID (let's call it UUID) in your system that is going to be linked to chat rooms.
To sync Chats, similarly to syncing Users, you can add Ethora API calls into your backend like so.
1. Implement Chat Create and Chat Delete procedures. Call /chats/ API for this purpose.
/chats/
access = [ "public", "private" ] Default: private. Public Chats can be joined by any User who has access to the server and knows its address. Private Chats can only be joined by Users you explicitly add.
UUID = integer. Here you may store reference IDs of entities in your existing business logic. This allows you to tie Chats with your existing business logic without having to store JIDs generated by Ethora.
When creating a new Chat, /chats/ will return the request status and if successful, JID of the newly created Chat.
Delete the Chat when your business logic doesn't need it anymore. Note: all chat history will be deleted as well through this action.
2. (optional) Implement Users access management for Chats.
Unless you set your Chats to be "public", you will have to manage which Users have access to your Chats.
This will depend on your business logic. For example, when case or communication is closed you can simply delete the Chat. However there are might be situations where the Chat is still required, but you need more Users to join the conversation or you need some Users to be removed from it.
/chat-access/
chatJid - you need to specify either JID (Ethora ID for Chats) or UUID (your ID for chat related entity) for Ethora to know which Chat room to work with
chatUuid - you need to specify either JID (Ethora ID for Chats) or UUID (your ID for chat related entity) for Ethora to know which Chat room to work with
userUuid - you need to specify either JID (Ethora ID for users) or UUID (your ID for users) for Ethora to know which User to work with
userJid - you need to specify either JID (Ethora ID for users) or UUID (your ID for users) for Ethora to know which User to work with
accessCode - specify access code to set for User for this Chat
0000 - no access (user is banned or removed)
xxx1 - read only access
xx1x - write access
x1xx - admin / moderator access
1xxx - owner access
accessTimer - if access setting is temporary (such as a temporary ban), specify time in seconds here for this setting to expire
Question
TarasFilatov
This is a step by step guidance on how to ensure the User accounts are in sync when embedding Ethora into your existing / legacy system which already has its own users authentication mechanism.
Such implementation ensures smooth experience for your end Users whereby they use Ethora features as part of your system without additional login or authentication steps required.
USERS SYNC
Implementation stage
Kick-off preparation
Launch
(OPTIONAL) CHAT ROOMS SYNC
You might want to tie Ethora-powered chat rooms to certain entities in your system.
Your system will know which chat room to display to the User depending on certain business logic of your system.
For example, chat room could be related to a certain communication between your team member and a client. This communication can be linked to a certain order, support ticket or case. Alternatively, there could be certain 'space' where a group of your users have access, and there is going to be a chat room for that space. Such as a workspace for a team collaborating on something, a game location etc. In such case you are going to have a certain unique entity ID (let's call it UUID) in your system that is going to be linked to chat rooms.
To sync Chats, similarly to syncing Users, you can add Ethora API calls into your backend like so.
1. Implement Chat Create and Chat Delete procedures. Call /chats/ API for this purpose.
/chats/
access = [ "public", "private" ] Default: private. Public Chats can be joined by any User who has access to the server and knows its address. Private Chats can only be joined by Users you explicitly add.
UUID = integer. Here you may store reference IDs of entities in your existing business logic. This allows you to tie Chats with your existing business logic without having to store JIDs generated by Ethora.
When creating a new Chat, /chats/ will return the request status and if successful, JID of the newly created Chat.
Delete the Chat when your business logic doesn't need it anymore. Note: all chat history will be deleted as well through this action.
2. (optional) Implement Users access management for Chats.
Unless you set your Chats to be "public", you will have to manage which Users have access to your Chats.
This will depend on your business logic. For example, when case or communication is closed you can simply delete the Chat. However there are might be situations where the Chat is still required, but you need more Users to join the conversation or you need some Users to be removed from it.
/chat-access/
chatJid - you need to specify either JID (Ethora ID for Chats) or UUID (your ID for chat related entity) for Ethora to know which Chat room to work with
chatUuid - you need to specify either JID (Ethora ID for Chats) or UUID (your ID for chat related entity) for Ethora to know which Chat room to work with
userUuid - you need to specify either JID (Ethora ID for users) or UUID (your ID for users) for Ethora to know which User to work with
userJid - you need to specify either JID (Ethora ID for users) or UUID (your ID for users) for Ethora to know which User to work with
accessCode - specify access code to set for User for this Chat
accessTimer - if access setting is temporary (such as a temporary ban), specify time in seconds here for this setting to expire
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.