https://discord.gg/botpress logo
restartConversation inside webchat:ready not worki...
# 🤝help
b
I'm getting the error
WARN restartConversation called before webchat component mounted
even though I'm using the event webchat:ready before trying to call window.botpress.restartConversation(). Any tips on how to handle this? I tried searching but couldn't find anyone with the same problem and it seems to be the correct event. https://cdn.discordapp.com/attachments/1481010449163092240/1481010449586720838/image.png?ex=69b1c1f7&is=69b07077&hm=37b24c7d8fb5c69509ee766d3b2cab1b473de24cb9b5047420d7a59fe4b928e8&
l
window.botpress.restartConversation() can only be called after Webchat is ready to receive messages. The method becomes available once the webchat:ready event fires. If you try to call it earlier, Botpress logs the warning you’re seeing.
b
yeah, i'm only doing it after the event - you can see the webchat:ready log that occurs above
and then the error follows afterward
l
hmmm interesting
b
for example:
Copy code
window.botpress.on("webchat:ready", () => {
      console.log("webchat:ready");
      checkAuthTransition();
    });
l
Can i get your bot ID @bitter-helmet-6983
b
yeah, one moment
l
also why are you calling restartConversation() after webchat is initialized?
b
I'm detecting if the person went from logged in to not logged in or vice versa for our auth state and then restarting the conversation - its mostly just to keep separate conversations unique if possible
5a8edb5d-3872-4ece-9f7f-54dcb32c8f87
We are using botpress mostly as a frontend framework to our custom agent and we keep a full log of all conversations. when they are anonymous we treat them differently than when they are logged in so we kind of want them split up if we can
l
oh @bitter-helmet-6983 since you are plus plan you know you could contact our solutions engineers directly right?
This little headset emoji!
b
Ah ok - I can do that too
l
They would be more suitible to help this specific case.
b
I was just already in here so thought to raise it. I'll do that
thanks!
l
Much love @bitter-helmet-6983 I can help with most things however certain areas are more suited for the solutions engineers!
2 Views