watsonx Assistant

watsonx Assistant

Conversational AI for fast and friendly customer care


#Artificialintelligence
#watsonxAssistant
#watsonx
 View Only
  • 1.  Dynamic Options

    Posted 06/03/22 11:01 AM
    Edited by System Admin 01/20/23 04:41 PM

    Hi there! I would like to set OPTIONS in a dialog node based on a JSON Array received from the WEBHOOK.
    For example: each identified user has a set of contracts in the backend system. I want to give the user, during the interaction with Watson, the list of active contracts so they can easily choose witch one to go on within the next steps. By now I am not able to build the list of options dynamically, or is there a workaround?
    Thanks!



    ------------------------------
    Marcos Lohmann
    ------------------------------
    #WatsonAssistant


  • 2.  RE: Dynamic Options

    Posted 06/03/22 11:26 AM
    Hi Marcos,
    Assuming your backend is returning the list of contracts in some context variable, then you should be able to utilize the functionality described  in Expression language methods | IBM Cloud Docs  (you may need to look into  Expressions for accessing objects | IBM Cloud Docs if you are unfamiliar with the basics)  to create a new context variable that holds a value obtained by manipulating the returned list into the shape you need. Look in particular at the examples in the first guide that relate to Arrays (filters, projections). Hope this helps!

    ------------------------------
    Patricia Goldweic
    ------------------------------



  • 3.  RE: Dynamic Options

    Posted 06/03/22 03:51 PM

    Thanks for your reply Patricia;

    This is what my back-end returns into $webhook_result_6:

    [
      {
        "label": "1 - Citratus - Citratus",
        "value": {
          "input": {
            "text": 1
          }
        }
      },
      {
        "label": "2 - Citratus - Intercompany (interno)",
        "value": {
          "input": {
            "text": 2
          }
        }
      },
      {
        "label": "3 - CISP - Ágille",
        "value": {
          "input": {
            "text": 3
          }
        }
      },
      {
        "label": "4 - CISP - Web Portal",
        "value": {
          "input": {
            "text": 4
          }
        }
      },
      {
        "label": "5 - HelpCompany - SOLIC",
        "value": {
          "input": {
            "text": 5
          }
        }
      },
      {
        "label": "6 - Plug - Plug",
        "value": {
          "input": {
            "text": 6
          }
        }
      },
      {
        "label": "7 - Cliente Teste - Virtual Assistant",
        "value": {
          "input": {
            "text": 7
          }
        }
      },
      {
        "label": "8 - Cliente Teste - Sistema de Consultas",
        "value": {
          "input": {
            "text": 8
          }
        }
      },
      {
        "label": "9 - Intercompany (interno) - Intercompany (interno)",
        "value": {
          "input": {
            "text": 9
          }
        }
      },
      {
        "label": "10 - Cognitivos - CIM Ecossistema de Vantagens",
        "value": {
          "input": {
            "text": 10
          }
        }
      },
      {
        "label": "11 - Cognitivos - Bionic Vision - Dolce Gusto",
        "value": {
          "input": {
            "text": 11
          }
        }
      },
      {
        "label": "12 - Cognitivos - Bionic Vision - Nespresso",
        "value": {
          "input": {
            "text": 12
          }
        }
      },
      {
        "label": "13 - Cognitivos - Módulo U",
        "value": {
          "input": {
            "text": 13
          }
        }
      },
      {
        "label": "14 - Acesse-Me - Portal Acesse-Me",
        "value": {
          "input": {
            "text": 14
          }
        }
      },
      {
        "label": "15 - ProspectPro - Sistema ProspectPro",
        "value": {
          "input": {
            "text": 15
          }
        }
      },
      {
        "label": "16 - Musica Pra Você - Web Portal",
        "value": {
          "input": {
            "text": 16
          }
        }
      },
      {
        "label": "17 - Suzano - SUZI - Suzano Responde",
        "value": {
          "input": {
            "text": 17
          }
        }
      },
      {
        "label": "18 - Demo - Consultas e Informativos",
        "value": {
          "input": {
            "text": 18
          }
        }
      },
      {
        "label": "19 - Eurofarma - MIA - Alexa",
        "value": {
          "input": {
            "text": 19
          }
        }
      },
      {
        "label": "20 - Eurofarma - EVA - Virtual Assistant",
        "value": {
          "input": {
            "text": 20
          }
        }
      },
      {
        "label": "21 - Eurofarma - MIA - Virtual Assistant",
        "value": {
          "input": {
            "text": 21
          }
        }
      },
      {
        "label": "22 - Eurofarma - E-Bulas",
        "value": {
          "input": {
            "text": 22
          }
        }
      },
      {
        "label": "23 - Eurofarma - Monitor 0800",
        "value": {
          "input": {
            "text": 23
          }
        }
      },
      {
        "label": "24 - Eurofarma - FEMINIS - Alexa",
        "value": {
          "input": {
            "text": 24
          }
        }
      },
      {
        "label": "25 - Eurofarma - Info Discover",
        "value": {
          "input": {
            "text": 25
          }
        }
      },
      {
        "label": "26 - Eurofarma - EVA - Alexa",
        "value": {
          "input": {
            "text": 26
          }
        }
      }
    ]


    This is the exact array schema used for OPTIONS

    I have already tryed with and without <? ?> and stil a JSON Parse error

    What am I missing?



    ------------------------------
    Marcos Lohmann
    ------------------------------



  • 4.  RE: Dynamic Options

    Posted 06/04/22 07:47 AM

    Hi all,
    Digging the web I found this... https://medium.com/ibm-data-ai/how-to-dynamically-add-response-options-to-dialog-nodes-in-watson-assistant-e14c5e08beca and got my question answered :-D
    Hope that helps somebody else!



    ------------------------------
    Marcos Lohmann
    ------------------------------



  • 5.  RE: Dynamic Options

    Posted 08/21/23 11:24 AM
    Edited by Andres Parada 08/22/23 09:21 AM

    Hi Marcos,

    This link is a paid one. Could you please update what exactly the fix you did? I am facing the same issue.

    Also, have you come across user_defined response type?  From Webhook to dialog options.

    Regards,

    ---------------------

    Davinder Bhagat

    ----------------------