Hey guys, I’m encountering a “ChatUserNotFoundException” error from the library, which makes sense in my current context. But I don’t see this error type listed in the docs (https://chatkitty.github.io/chatkitty-js/classes/error.chatkittyerror.html)
My initial assumption was that I can create a connection between any two users / email address / hashed strings, but this doesn’t appear to be the case. It seems that each username must first have a session before I can establish a channel between them.
I was hoping to get some more info about what the expected flow is. Perhaps a diagram would be helpful for illustrating these details, just to clear up any incorrect assumptions.
To rephrase and clarify, it seems that I must write a script to iterate through all users of my platform to create a session on their behalf which would “register” the usernames, and then I could begin to setup channels between them. Accurate?
Thanks!
Hey @john.turnham, welcome to ChatKitty Community!
ChatUserNotFoundException
is sent by the ChatKitty service when a client attempts to reference a user that does not exist. https://chatkitty.github.io/chatkitty-js/classes/error.chatkittyerror.html covers errors generated client-side, I’ll update the main docs site https://docs.chatkitty.com/ with a complete list of server-side error types.
About your main question, the best way to create your users is through the Platform API. You can use the create user REST endpoint to create users when they register for your service, using a unique string as the user name property.
When you started a session without passing in authParams
in the kitty.startSession(...)
request, a guest user was automatically created with the passed-in username because guest-mode is enabled by default for testing applications. However, for an application with a back-end, I recommend disabling guest mode, creating the users using the Platform API when a user registers for your service, writing a script that migrates existing users, and authenicating user session using the “User Attempted Start Session” chat function. You can find more information about using the Platform API, including authentication here.
I hope that helps!