On our website, we use Botpress' website embedding function
<script>
window.botpressWebChat.init({
host: OWN_URL:BOTPRESS_PORT,
botId: "test12345"
})
</script>
which displays the bot and allows interacting with it. Up to this point, everything works as expected.
However, in the next step, we intend to define a custom userId
to store existing conversations and restore them, when logging back into the system. While Botpress allows defining a custom userId, it seems not to be used for storing and reloading the current conversation at a later point. Instead, even when initializing the chat/conversation with this userId
:
<script>
window.botpressWebChat.init({
host: OWN_URL:BOTPRESS_PORT,
botId: "test12345",
userId: "example12345"
})
</script>
then retrieving the conversationId
from the Networks-Tab and trying to reload the conversation in another window using:
<script>
window.botpressWebChat.init({
host: OWN_URL:BOTPRESS_PORT,
botId: "test12345",
userId: "example12345",
conversationId: ID_RETRIEVED_FROM_NETWORKS_TAB
})
</script>
Botpress sends a "The conversation ID doesn't belong to that user"
error message, which can be found within this file.
Debugging the point of error tells us that even though the conversation is found:
{
id: 'd3178f66-3b4f-493e-aa39-ce8fcc2195a3',
clientId: '076ea353-fcd7-4984-869e-713e12b0176f',
userId: 'a317d806-a6ad-493f-b3b3-70c792f29445',
createdOn: 2022-07-15T16:39:56.523Z
}
the userId
differs (e.g., 705d31e8-c6e0-4e7b-a28f-f0da46390653
) -> conversation.userId !== userId
.
It seems like setting a userId
when initializing the bot (or at a later point – we tried this as well) does not have an influence on the userId
set in the conversation.
Now the question is as follows: How can you restore existing conversations of a custom userId
in Botpress? Or is this a Pro-feature when referring to user authentication?
Our main idea is just about using an existing user (of our system), e.g., example12345
to have a conversation and when logging back into the system (from another computer, for instance) to restore this conversation.
Thanks for any hint!
Additional links: