1
votes

I'm trying to get values from an API to a dialog node of Watson Assistant. Using the webhook option, the API call happens but the parameters i set are not used on the request.

parameter from dialog node

API code:

app.post('/', async (req, res) => {
  const result = await get('https://api.senior.com.br/' + req.query.link)
  console.log(result);
  res.json({result}) 
});

The request.url or the request.query.link returned is just '/', just when i make the call manually this variables have the parameter that I send.

2

2 Answers

0
votes

I manage to get the parameter link from "req.body.link" (u.u), I just don't know why it doesn't appears on "req.query.link".

0
votes

IBM Watson Assistant invokes the defined webhook via http POST request. Thus, there are no query parameters, only the payload in the request body. Thus, in your code you need to use req.body (request body) instead of req.query (query parameters).