3

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?

briantaurostack7
  • 1,193
  • 2
  • 14
  • 36

2 Answers2

10

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
  }
}
Dudi
  • 2,340
  • 1
  • 24
  • 39
  • To accomplish the above you will need to click on Watson Response -> Advanced – Dudi Oct 27 '16 at 06:17
  • How do I invoke the Watson Conversation via a phone call – briantaurostack7 Oct 29 '16 at 18:54
  • 1
    @briantaurostack7 could you elaborate? you can use Watson STT and TTS along side Watson Conversation. I suggest you open a different question for this. – Dudi Oct 29 '16 at 20:55
  • @Dudi should my application look for "skip_user_input" in the context and decide to call the Conversation Service immediately ? Or does the Conversation Service itself proceed to the next node, in which case I don't understand how the request gets executed ... – mpjjonker Dec 13 '16 at 12:31
  • 2
    Your app needs to handle the request, it will typically update some context variable. conversation will auto skip the input in the next api invocation. As it sees skip_user in the api call – Dudi Dec 13 '16 at 15:44
  • Hi, friends. I have a similar problem: trying to put a single html input (type e-mail) inside a conversation dialog. Watson conversation does not capture the typed value into a context variable. Must I use this kind of context request, in order to obtain the typed email? Obs: I have also put a submit button below the input field. – Alexandre Marini Feb 20 '17 at 13:42
  • Hello, can anyone please suggest an example for the same? – kallada Oct 10 '17 at 19:07
  • @Dudi please suggest an example for the same? – kallada Oct 10 '17 at 20:40
1

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

csharpnewbie
  • 789
  • 2
  • 12
  • 33