简体   繁体   中英

Watson Assistant programmatic to Heroku webhook not working

I have created a Webhook ( https://moviebotdf.herokuapp.com/get-movie-details ), it is tested with postman and dialogflow and working properly.

I want to integrate it with IBM Watson Assistant via programmatic call, but this is not returning anything (ie the output is "").

I checked the IBM support ( https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-actions&locale=en ) and also other solutions as calling a function that could call the webhook but I am having even less succcess there. As I understand from the support, a direct call from the Assistant to the Webhook should be possible (and easier for newbies like me), hence is the solution I seek. Code in the Assistant is as follows:

{
  "context": {
    "skip_user_input": true,
    "prodname": "$prodname"
  },
  "output": {
     "text": {
        "values": [
             "$dataToSend"
        ],
     "selection_policy": "sequential"
    }
  },
  "actions": [
     {
       "name": "https://moviebotdf.herokuapp.com/get-movie-details",
       "type": "client",
       "parameters": {
           "prodname": "$prodname"
       },
      "result_variable": "context.dataToSend"
     }
  ]
 }

So "prodname" is captured by Watson Assistant in the previous node (I checked that and it is working correctly) and sent to the Webhook. The variable used in the Webhook is also called "prodname". The expected output from the Webhook is stored in the variable "dataToSend", but as said above the answer in Watson is only "" as "$dataToSend" is "".

I tried also with "result_variable": "dataToSend" and "result_variable": "$dataToSend" without success, so what I guess is that the webhook is not being called...

I am new in the topic, so please do not hesitate to correct any problems in my post.

Thanks in any case in advance!

Adrià

IBM Watson Assistant lists three different options of making a programmatic call from within a dialog node:

  1. client : your app is in charge of calling out to the action
  2. server or cloud_function : IBM Cloud Functions action is invoked from Watson Assistant
  3. web_action : The web action of an IBM Cloud Functions action is invoked from Watson Assistant

If you host your webhook on IBM Cloud Functions, then Watson Assistant can directly call it. With your current hosting and client specified, your app is in charge. In that case your app needs to check that the context includes the information about a client action, extract that related metadata, invoke the webhook and send the data back to Watson Assistant.

I have written an example for such a client action for my Watson conversation tool . See that repo for instructions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM