Search code examples
ibm-cloudibm-watsonwatson-assistant

How to respond with dynamic options in IBM Watson Assistant?


My webhook returns an array of elements. I need to make IBM Watson Assistant respond with those elements as options to the users.

How can I achieve that?


Solution

  • @data_henrik response was very helpful but it was little vague. So, I thought to post my own answer. I made some changes in my function so that the result it returns matches the options format just like in the image below.

    enter image description here

    And just as @data_henrik suggested, I stored that result in a context variable named myOptions and used it like :

    <? output.generic.addAll($myOptions) ?>