I want to have a config page, where the user can setup the credentials of the Watson Assistant to use.
Actually, to setup the credentials, you need something similar to:
var assistant = new AssistantV1({
username: process.env.ASSISTANT_USERNAME,
password: process.env.ASSISTANT_PASSWORD,
url: 'https://gateway.watsonplatform.net/assistant/api/',
version: '2018-02-16',
});
and then you do:
assistant.message({
input: { text: newMessageFromUser },
workspace_id: process.env.WORKSPACE_ID,
context : response.context,
}, processResponse)
Obviously, if on my config page the user chose to use another workpace with other IDs, I cannot do again the "const assistant = new AssistantV1"
and do another new one with other credentials. I am looking into a way to pass them as parameters when someone changes the configuration on the config page.
In order to do so, is it possible to pass not only the workspace but also the username and password as parameters to assistant.message
? If it is possible, how can I do it? What options do I have to change the username & password on the conversation invocation?
Thanks!