Execute code works in studio but not in production...
# 🤝help
h
open in new tab to this website  https://www2.apptoto.com/b/bryanmathnasium/#availability__%7B%22appointmentTypeToken%22:%22self_booked_assessment%22%7D
This prompt generates the following code
Copy code
const websiteUrl = "https://www2.apptoto.com/b/bryanmathnasium/#availability__%7B%22appointmentTypeToken%22:%22self_booked_assessment%22%7D"
window.open(websiteUrl, '_blank')
Which works fine in the studio but not in production
Sorry, an error occurred. Please try again later
a
@famous-zoo-73118 do you know if the webchat (or browsers) would block code like
window.open()
from running?
f
It's because the bot code runs on the server side, and the
window
object is only available when running on browsers (client side).
@helpful-vr-6699 If you test your bot again and then immediately check the Logs section of your bot in the BP Cloud dashboard it should show the exact error.
h
I know redirect works but we don't want the user to leave the site
Yes window is not defined
Actions Error executing action "inline-ins-d4c039bfb0.js" in flow:Main:node:Schedule_Site [ReferenceError, window is not defined] Timestamp Jul 28, 2023, 6:15:48 PM Level ERROR
f
Correct
h
If we put the link for the client to click would that open in new window?
[text](url) is this the correct format for hyperlink text?
f
Yes, it will open in a new window. Yes, that format is correct.
h
I am strugglign with delay also I am not sure if I can ask here?
f
(markdown format basically)
h
I want to add some delay between messages but it's executing the delays all at once
f
You can also enter a plain valid URL, it should convert it to a link automatically
can you share some screenshots of how you're implementing the delays?
h
https://cdn.discordapp.com/attachments/1134370392111316992/1134521175666606212/Botpress_-_Delay_issue.mp4

https://cdn.discordapp.com/attachments/1134370392111316992/1134521176559997068/image.png

https://cdn.discordapp.com/attachments/1134370392111316992/1134521176996200488/image.png

I tried spliting the cards in separate nodes, text + delay
but still works the same
In the studio it looks OK
f
Thanks for recording a video, this is super detailed. It's a very interesting behavior that you have found, I'll record this internally so our team can investigate, and we'll back to you here as soon as we have more information! 🙂
5 Views