ibm-watsonwatson-assistant

How do I get Watson Assistant to automatically open a webpage?


I want Watson to open a webpage on my website, either in the same tab or in a new tab, when a customer selects a response button.

Currently, I'm just having Watson provide a link that the customer has to manually click and open, instead of having Watson automate it.


Solution

  • Opening a web page automatically, either in the same tab or in a new tab, usually uses JavaScript, which is client-side and therefore out of Watson's control.

    If you want to implement this, you will need to do it in the context of your own website using your website's code. Here is a simple JavaScript example:

    window.open('http://www.example.com', '_blank');
    

    This line of code will open a new tab (because of the _blank parameter) and navigate to "http‍://www.example.com". If you want to open the URL in the same tab you can use:

    window.location.href = 'http://www.example.com';
    

    However, integrating this with Watson Assistant will depend on your web page setup. Typically, you'll trigger such a script based on a specific user interaction or message from a chatbot.