How to make Watson Conversation Api Invoke a web Application Url when User Enters an Input?

我怕爱的太早我们不能终老 提交于 2019-11-26 16:57:34

问题


I have a spring mvc application and I would like to make my user call a bot and the bot based on user input should access a url and based on the response provide an answer.How could I achieve this in Java?


回答1:


There is no direct way to do it. However, Watson Conversation does provide a mechanism to handle such requests. You will need to tell the calling Java app that a url needs to be invoked.

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
  }
}



回答2:


This feature is now available, with the help of IBM cloud functions. The link has the details of the implementation.



来源:https://stackoverflow.com/questions/40263747/how-to-make-watson-conversation-api-invoke-a-web-application-url-when-user-enter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!