Gerard Segismundo
Gerard Segismundo

Reputation: 45

Where can I get "workspace_id" parameter for Watson-Assistant?

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.

Upvotes: 1

Views: 1310

Answers (3)

Jebasteen
Jebasteen

Reputation: 1

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)
});

Upvotes: 0

Vidyasagar Machupalli
Vidyasagar Machupalli

Reputation: 2865

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.

Upvotes: 3

data_henrik
data_henrik

Reputation: 17156

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.

Upvotes: 4

Related Questions