-->

Open URL in IBM Watson conversation

2019-01-20 07:27发布

问题:

I am using a Blumix free account to develop a chat-bot using watson conversation.

How do I add a clickable URL in the response, or automatically call a URL in browser?

I have edited the "advanced response" using the suggestions as described on this page but could not get it work.

How can I achieve that?

回答1:

I don't know if I understood your question correctly, but.. if you wants add some url inside flows Conversation Service (IBM Watson), try it:

1º: Add the url with tag <a target> and href= your URL inside flows. See the example:

JSON:

"output": {
            "text": "This is a link <a  target=\"_blank\" href= \"https://www.choosemyplate.gov\">Food and nutrition Guide</a>.\n<br/><br/>Talk to you later, bye for now!"
        },

2º See that it did not work inside the Conversation, because it will be your browser that will render the html.

3º If you open with your browser, it works, see:

See that the link is showing up, and this will work for other things in html, like button, for example...

But if you can: based on user input should access a url:

This is done by using two features: Context.request skip_user_input

A request is a special context variable that has args, name and result. It is used to tell the calling app that it should do some action based on this variable.

Setting skip_user_input is optional. In many cases, you might want to execute some business logic in your application and then provide its results via result. Setting skip_user_input to true, will tell Watson Conversation to not wait for input from the user. Thus, your condition on the next node should be based on the content inside result.

 {
      "output": {},
      "context": {
        "request": {
          "args": {
            "url_to_invoke": "your_url"


  },
      "name": "Call_A_URL",
      "result": "context.response"
    },
    "skip_user_input": true
  }
}

Reference: IBM Professional @Dudi: here.