ibm-cloudbotswatsonwatson-conversationwatson-assistant

How to extract variables into a text file from Watson Assistant?


I want to be able to store context variables into a text file. Im using this code:

"context" : {
    "number_extract" : "<? input.text.extract('[\\d]+',0) ?>"
}

to extract variables into and store in context variable. But now i want to be able to extract it from Watson Assistant for e.g. store it into a text file or any other format. Is this possible or is there another way?


Solution

  • Yes, you can store the context from variables in text files or in a database. Watson Assistant allows to make programmatic calls from within a dialog. The code that is invoked would then take care of writing the extracted information to the file or database.

    I wrote a tutorial that uses the extracted information to store it in a database or to search in that database with extracted search terms. The code is on GitHub, so you can see how it is done.