Community

Watson Conversation: How to Manage Workspaces

Share this post:

I am a big fan of using the command line as most of you know by now. This applies to interacting with IBM Bluemix cloud and its services and for database systems like DB2 or dashDB. Thus, I was excited when the IBM Watson Conversation service added API functions to manage workspaces for the chatbots. To test the new API and look into its potential I wrote a small Python-based tool to manage Conversation workspaces. It both demonstrates the API usage as well as gives you a nice command line tool to list your workspaces, update them, save local copies or even create or delete workspaces. Read on and learn how to manage your Conversation workspaces via API or from the command line.

Overview

For the IBM Watson Conversation service, a workspace is the core object where everything comes together. It holds the metadata, it includes intents, entities and the dialog nodes. Basically, it is the center of a chatbot. The new Conversation API functions allow to manage the full lifecycle of those Conversation workspaces. Creating a new workspace, updating individual sections or replacing it entirely, and eventually deleting a workspace is possible. Existing workspaces can be listed and their details obtained. Sounds interesting. Thus, I wrote a small script “wctool.py” that makes use of those API functions. It allows to manage the Conversation workspaces from the command line with a single program:

  • List available workspaces:
    python wctool.py -l
  • Get details on a specific workspace:
    python wctool.py -g -id “conversation-workspace-id”
  • Export a Conversation workspace to a file:
    python wctool.py -g -id “conversation-workspace-id” -o myOutputFile.json
  • Create a new Conversation from a file:
    python wctool.py -c -id “conversation-workspace-id” -i myInputFile.json
  • Update an existing Conversation workspace and replace intents and dialog nodes:
    python wctool.py -u -id “conversation-workspace-id” -i myChangedFile.json -intents -dialog_nodes

There are some more commands and options. Check out the GitHub repository for the watson-conversation-tool (wctool.py) and the included Jupyter Notebook showing a sample session using the commands.

Installation

If you have been working with the Watson service and Python before, you probably already have everything installed. If not, you need to install Python and then head over to the Watson Developer Tools and follow the link to the Python SDK. Install that as well. Now, download a copy of or clone my repository watson-conversation-tool. As last step, copy the file “config.json.sample” to “config.json” and fill in your credentials for the Watson Conversation service. Done.

Closing Words

Let me know if you have questions or feature requests by opening an issue against the GitHub “watson-conversation-tool” repository or reaching out to me.It is important to note that the tool is a code sample at this point and not an officially supported tool. So please use it “as-is”.

Technical Offering Manager / Developer Advocate

More Community stories
May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Analyze Logs and Monitor the Health of a Kubernetes Application with LogDNA and Sysdig

This post is an excerpt from a tutorial that shows how the IBM Log Analysis with LogDNA service can be used to configure and access logs of a Kubernetes application that is deployed on IBM Cloud.

Continue reading