diff --git a/.env.example b/.env.example
index a14bcb8d..a736943b 100644
--- a/.env.example
+++ b/.env.example
@@ -1,11 +1,21 @@
# Environment variables
-ASSISTANT_URL=https://gateway.watsonplatform.net/assistant/api
-ASSISTANT_ID=
+ASSISTANT_URL=https://api.eu-gb.assistant.watson.cloud.ibm.com
+ASSISTANT_ID=3xxxxx-xxxx-xxxx-xxxx-c508e6a7d3b2
# IBM Cloud connection parameters
-ASSISTANT_IAM_APIKEY=
-ASSISTANT_IAM_URL=
+ASSISTANT_IAM_APIKEY=5u30uOLxxxxxxxxxxxxxxxxxxxxxxxhKksG
# Cloud Pak for Data connection parameters
BEARER_TOKEN=
-DISABLE_SSL_VERIFICATION=false
\ No newline at end of file
+DISABLE_SSL_VERIFICATION=false
+
+
+
+#Upload parameters
+# Use V1 to update workspace
+# workspaceid is the skill id
+# https://cloud.ibm.com/apidocs/assistant/assistant-v1?code=node#updateworkspace
+
+apikey=
+workspace_id=20adfxxxx-xxxx-xxxx-xxxx-axxxxx75929
+url=https://api.eu-gb.assistant.watson.cloud.ibm.com
diff --git a/.travis.yml b/.travis.yml
index c631fde6..d290e1e3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: node_js
dist: trusty
sudo: required
-node_js: 12
+node_js: 14
script:
- npm run test
@@ -24,4 +24,4 @@ deploy:
repo: watson-developer-cloud/assistant-simple
- provider: script
skip_cleanup: true
- script: npx semantic-release
+ script: npx -p node@14 -c "npx semantic-release"
diff --git a/README.md b/README.md
index 97361ceb..573591e8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
🚀 Watson Assistant (formerly Conversation) Sample Application
+🚀 Watson Assistant Sample Application
This Node.js app demonstrates the Watson Assistant service in a simple interface engaging in a series of simple simulated banking tasks.
@@ -46,6 +46,7 @@ If you need more information about the V1 API, you can go to the [Watson Assista
5. Click the  icon to copy the workspace ID to the clipboard.

+6. Alternate way is to setup workspace using upload.sh also set up env for the workspace.
6. In the application folder, copy the *.env.example* file and create a file called *.env*
diff --git a/app.js b/app.js
index fddf7ca4..2f2b9c1b 100644
--- a/app.js
+++ b/app.js
@@ -45,8 +45,8 @@ if (process.env.ASSISTANT_IAM_APIKEY) {
var assistant = new AssistantV2({
version: '2019-02-28',
authenticator: authenticator,
- url: process.env.ASSISTANT_URL,
- disableSslVerification: process.env.DISABLE_SSL_VERIFICATION === 'true' ? true : false
+ serviceUrl: process.env.ASSISTANT_URL
+ //disableSslVerification: process.env.DISABLE_SSL_VERIFICATION === 'true' ? true : false
});
// Endpoint to be call from the client side
@@ -69,14 +69,19 @@ app.post('/api/message', function(req, res) {
if (req.body.input) {
textIn = req.body.input.text;
}
-
+ // accessing context data
+ //https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-api-client-get-context&code=javascript
var payload = {
assistantId: assistantId,
sessionId: req.body.session_id,
input: {
message_type: 'text',
text: textIn,
+ options: {
+ 'return_context': true
+ }
},
+
};
// Send the input to the assistant service
diff --git a/package.json b/package.json
index 20ab1f03..72072e7c 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"access": "public"
},
"engines": {
- "node": ">=12"
+ "node": ">=14"
},
"engineStrict": true,
"devDependencies": {
diff --git a/public/js/api.js b/public/js/api.js
index f1524618..ab17aa3e 100644
--- a/public/js/api.js
+++ b/public/js/api.js
@@ -57,6 +57,9 @@ var Api = (function() {
payloadToWatson.input = {
message_type: 'text',
text: text,
+ options: {
+ 'return_context': true
+ }
};
diff --git a/upload.sh b/upload.sh
new file mode 100755
index 00000000..ac051ef5
--- /dev/null
+++ b/upload.sh
@@ -0,0 +1,12 @@
+# Local .env
+# https://gist.github.com/mihow/9c7f559807069a03e302605691f85572
+if [ -f .env ]; then
+ # Load Environment Variables
+ export $(cat .env | grep -v '#' | awk '/=/ {print $1}')
+ # For instance, will be example_kaggle_key
+ # echo $KAGGLE_KEY
+fi
+
+curl -X POST -u "apikey:${apikey}" --header "Content-Type: application/json" \
+ -d @training/bank_simple_workspace.json\
+ "${url}/v1/workspaces/${workspace_id}?version=2021-06-14"