1

I am currently new to IBM Watson (Watson Assistant) and I can't figure it out. Where can it be found?

code:

var watson = require('watson-developer-cloud');

var assistant = new watson.AssistantV1({
  iam_apikey: '{apikey}',
  version: '2018-09-20',
  url: '{url}'
});

assistant.message({   
  workspace_id: '{workspace_id}', //  <-- THIS, where can i get the right parameter.   
  input: {'text': 'Hello'}
},  function(err, response) {
  if (err)
    console.log('error:', err);
  else
    console.log(JSON.stringify(response, null, 2));

Thanks.

data_henrik
  • 16,724
  • 2
  • 28
  • 49

3 Answers3

4

There are two options on how to retrieve the workspace ID for IBM Watson Assistant.

  1. In the browser-based tool click on Skills, then on the three dot menu. There, click on API details. It will list the Skill name and ID, the Workspace ID and some more information.
  2. In your program which uses the Assistant V1 API, there is a listWorkspaces function. It retrieves information about the workspaces in your instance of Watson Assistant.
data_henrik
  • 16,724
  • 2
  • 28
  • 49
3

Here's a link to the answer you are looking for IBm Cloud Watson Assistant: How to get the ID of a workspace

As you are using V1 of Watson Assistant service, it is Workspace ID. Effective V2 of Watson Assistant, you will be using Skills and require Skill ID.

Vidyasagar Machupalli
  • 2,737
  • 1
  • 19
  • 29
0

Watson-developer-cloud is deprecated as of September 2020. Hence we must install ibm-watson instead and then use this code. It displays some details including the Workspace ID.

const AssistantV1 = require('ibm-watson/assistant/v1');
const { IamAuthenticator } = require('ibm-watson/auth');
const assistant = new AssistantV1({
    version: '2020-04-01',
    authenticator: new IamAuthenticator({
        apikey: '{api_key}',
    }),
    serviceUrl: '{your_service_URL}',
    disableSslVerification: true,
});
assistant.listWorkspaces().then(res => {
    console.log(JSON.stringify(res.result, null, 2));
    })
    .catch(err => {
        console.log(err)
});
Jebasteen
  • 1
  • 1