Open URL in IBM Watson conversation

2019-01-20 07:04发布

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条回答
我想做一个坏孩纸
2楼-- · 2019-01-20 07:42

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:

enter image description here

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.

enter image description here

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

enter image description here

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.

查看更多
登录 后发表回答