flat-fuchsia•2y ago
Open URL in Chatbot
Hi, I'd like to send my user to a URL upon completion of a chat. Specifically, when the user is finished the chat, I want to send them to a Thank You page on my website. Is there a simple way to do this? Any help would be appreciated.
4 Replies
To redirect users to a specific URL upon completion of a chat, you can use the JavaScript API provided by Voiceflow. Unfortunately, there isn't a built-in feature in the chat widget to redirect users to a URL, but you can achieve this by listening to the 'done' event and then redirecting the user using JavaScript's window.location.href.
Here's an example of how you can do this:
In this example, replace 'YourProjectID' with your actual project ID and 'https://yourwebsite.com/thank-you' with the URL of your Thank You page.
Please note that this will only work if the chat ends with a 'End Interaction' step in your Voiceflow project. The 'done' event is triggered when the chat reaches an 'End Interaction' step.
For more information on how to use the JavaScript API, you can refer to the Voiceflow documentation.
flat-fuchsiaOP•2y ago
That doesn't quite work for me. I need to be able to send them to a different URL according to different variable values. So it can't be just on "done".
You can use a custom version of the react-chat and a Custom Action step to pass the URL you want. In your custom integration, check for the Custom Action payload in the Dialog API trace and redirect the user to that URL.
flat-fuchsiaOP•2y ago
Thank you. That miight be a little over my head, but I'll do some research and try it...