Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webhook integration with Watson Assistant?

I want to know whether IBM Watson Assistant has the feature of calling webhook.

It means when an intent of workspace is matched Watson Assistant need to send a post request to an external server including the intent in the request body.

Example for a webhook:

https://123.456.789.12:7788/myWebhook/testMethod

IBM Watson Assistant need to send a Post request to this service and that service will return a text string. Watson Assistant should get that text and show it to the user.

That is my usecase. Will it work with Watson Assistant?

i found the below documentation from IBM site. https://console.bluemix.net/docs/services/conversation/dialog-actions.html

It says to update the json response. i.e. add another key value pair to json object as "action". in the action json array there is "name" parameter. I added above url to name parameter and checked by calling the intent whether a request comes to my web service but it didn't.

following is my json response. i assumed once the intent is matched a post request should go to my web service. but i checked my web service by printing the request body on the console. but no any request came to it. could you please tell me where did i miss?

{
  "context": {
    "skip_user_input": true
  },
  "output": {
     "text": {
        "values": [
             "your current outstanding balance is $my_balance ."
        ],
     "selection_policy": "sequential"
    }
  },
  "actions": [
     {
       "name": "https://123.456.789.12:7788/myWebhook/testMethod",
       "type": "client",
       "parameters": {
           "body": "$body"
       },
      "result_variable": "context.my_balance"
     }
  ]
 }
like image 446
Dhanushka Sampath Avatar asked Feb 14 '26 08:02

Dhanushka Sampath


2 Answers

You found the correct method, i.e. dialog actions, to implement webhooks.

Watson Assistant supports server- or client-side actions:

  • For the server-side action you would set up an action with IBM Cloud Functions. That action would call the webhook.
  • For client side, you would pass the information similar to what you show in the question to the app (client). Your app would need to react and to call the webhook.

From what I read about your case I recommend checking out the server-side action. This tutorial about a database-driven bot implements a couple of those actions. Instead of calling the database, you would call out the webhook.

like image 143
data_henrik Avatar answered Feb 18 '26 00:02

data_henrik


As of August 2019, there is now an integrated webhook feature in Watson Assistant.

like image 31
newbold Avatar answered Feb 18 '26 00:02

newbold



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!