https://discord.gg/botpress logo
Start existing webchat conversation using a conver...
# 🤝help
b
Hey, still trying to work out whether this is possible, getting conflicting information from the docs bot, and would like a definitive answer before we move on to try other things. Basically, we are looking to begin a conversation via the Chat API from our backend, and pass context information into that chat. We can do this with the following calls which are working: /users/get-or-create (create or fetch user with userId) /conversations (begin convo, get conversationId) */events * (send custom event containing context data) We now have a userId and a conversationId so feel it should now be possible to later on start up this same conversation when the bot user clicks a link in their email. In our website, we've successfully embedded the webchat UI, currently doing this using the React Webchat component. [In the docs for this](https://www.botpress.com/docs/webchat/react-library/components/webchat), it shows that we can add conversationId and UserCredentials as props to this component, with the UserCredentials being made up of userId and userToken. However, I can't find any docs that discuss how to use these. My assumption would be that userToken would be a jwt created using the userId and some secret (like we do for the Chat API), however I can't find anywhere to set this secret in the Webchat configuration. Can I please have some help with this? If this isn't possible, what are some alternatives to achieve this "pre-baking" of conversation information that is completely ready for use when the user initiates a bot conversation? https://cdn.discordapp.com/attachments/1440637878710308885/1440637879112958036/image.png?ex=6943cc14&is=69427a94&hm=232f47e5bc9533761d6f7824b51a5473c7047e0fdebbe0f85a19a2345554ee27&
b
I'm really sorry I can't help, but is this possible create or using fetch [userToken]? like how much token does user used? I'm curious. thank you btw for your post.
b
I can't see any API calls to fetch user token, if I create it I would need the secret that botpress holds to sign it
l
Hey @boundless-cartoon-88019 will do some digging and get back!
The
userToken
is generated by the Botpress backend when
createUser()
is called: This API call returns both: -
user.id
(the userId) -
key
(the userToken)