1
votes

I would like to create a test script for a IBM Watson Assistant chatbot. So I am using the Assistant V2 API.

Below code is On the IBM Watson Assistant page.

import json
from ibm_watson import AssistantV2
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
assistant = AssistantV2(
    version='2020-02-05',
    authenticator = authenticator
)

assistant.set_service_url('{url}')

response = assistant.message(
    assistant_id='{assistant_id}',
    session_id='{session_id}',
    input={
        'message_type': 'text',
        'text': 'Hello'
    }
).get_result()

print(json.dumps(response, indent=2))

My questions is where {url}, {session_id} are And also {workspace_id} (for using Assistant V1)?

1
I am not sure what you try to ask. Any references to documentation that is unclear or any API you are using?data_henrik
I modified question. Specifically, I can't find url, session_id, and workspace_id. I found assistant_id and skill_id. There are too many ids and url...will Park

1 Answers

2
votes

You can find the URL and API key in the resource page for that service. There you can also create additional credentials. When you open the Watson Assistant UI, there are two tabs on the side. One is for Assistants, the second for Skills. Go to skills and then for a skill, click on the 3-dot-menu and select API details. There you find all necessary information.

See this IBM Watson Assistant doc page for an introduction to the V2 and V1 APIs.

Session_id is created in V2 when you create a session.

BTW: I wrote a Python test script for Watson Assistant a long time ago. There is one for V1 and one for V2 API.