Is your change proposal related to a problem? Please describe.
In issue #23 we are building public-facing functionality where a widget is embedded on a third-party (clients) website. There are several things the platform doesn't handle for this use case:
- Unauthenticated access - at present users need an account and authenticate
- Anonymous users - at present users have an identity that we can attach state to, partition by, track over time, and authorise using. We need to have a way to accept anonymous interactions while tracking usage so we provide customers with insight, power the context etc.
Propose the solution you'd like
Phase 1:
ephemeral sessions - generate a unique id (UUID) for each new user session. partition all interactions using this user ID. Don't persist anything in the backend. Have a sliding time window for session expiration (i.e. time of last user interaction + X minutes, where X=15mins). Use local storage to track history.
This is an MVP and should be good enough to start deming the functionality even trialled for real.
Phase 2:
Persist the session on the client side and the server side
User - A user arriving at a clients marketing website will click on a familiar chat bot icon on the bottom right of the website to launch/open the chat window, hence start a session. When the same user returns on the same device they will see their chat history. Initially, we'll support a single chat thread to keep it simple.
Customer - The customer configured the chatbox with a specific public Space in their instance. They are able to see some basic stats on the users interacting with the bot such as number of users in the last 1day and 7day. They can also see chat history, the questions and responses per user. Later we may use GenAI to give insight on this data.
Technical:
- Adopt the backend to be able to use UUIDs for users, this should enable the data layer to handle both anonymous users and authN users the same.
- Secure chat/response web API calls (TBD) - maybe CORS is sufficient. We are trying to prevent usage abuse and prompt injection type issue not data privacy.
Describe alternatives you've considered
We can not bother converting the backend to use UUID for user IDs but then persisting anything by user will require a code branch to handle the two different types of users (anonymous vs authN) which is probably more complicated.
Additional context
Given we have little input from a real customer and usage at this point we should be cautious about over-engineering prematurely but structure to hedge so we can adopt quickly if we need to.