Daily Archives: June 27, 2017

Using Slots to collect data in IBM Watson Conversations

A new feature was released in IBM Watson Conversations earlier this month called “Slots”. This feature allows the collection of data from users to be configured in a more data driven and succinct manner than was previously possible.

In a previous post, I explained an approach for recursively collecting information that relied on configuring a flow with “Jump To” conditions or “Continue From” as they were called back then.

Using slots is pretty easy once you’ve done it a couple of times and the resulting node structure is very simple even in quite complex use cases. Let’s update my example from previous posts with this new approach.

Download the starter template which contains the basic structure and import it into a Watson Conversations Instance (see here for how to import). The workspace includes a couple of intents (Open and Close Accounts) and two entities (Account and Subscription Type). The basic idea is that we are building an assistant that will help us open an account for which two pieces of information are required.

Once imported use the “Add Node” button at the top of the dialog tab and set the node condition to #Open_Account” as shown below.

IBM Watson Conversation Slots 1

Next click on the customise link at the top of the right hand edit panel just above the #Open_Account condition. In the dialog that opens select the first checkbox to enable the Slots feature, ignore the “Prompt for everything” checkbox for now.

ICM Watson Conversations Slots 2

Clicking “Apply” will result in an update in the right hand edit panel and the addition of the Slot editor. Let’s add our first Slot, type @Account_Type into the “Check for” field of the first row and something like “You can open a Bronze, Silver or Gold account. Which option would you like?” to the “If not present, ask” field. The “save as” field will be defaulted for you and the default is fine for our purposes.

IBM Watson Conversation Slots 3

Next click the “Add slot” link and enter @Subscription_Type into the “Check for” field and something like “Would you like to pay monthly or annually?” into the “If not present, ask” field.

Finally we need to add the response that will be presented to the user when both account type and subscription type have been collected. In the section “Then respond with” add something like “Super. I’ll open your <? $Account_Type ?> account with <? $Subscription_Type ?> billing.”. The placeholders for $Account_Type and $Subscription_Type will be replaced with the values from context, you can see where this context is set by clicking on the cog iconScreen Shot 2017-06-26 at 16.35.27 to the right of the slot, then select the hamburger menu Screen Shot 2017-06-26 at 16.36.08 and select the “Open JSON editor” option.

Screen Shot 2017-06-26 at 16.36.17

The resulting flow should handle the possible variations of user input in a single dialog node rather than the 5 nodes we needed in my previous example. Try out the following variants:

  • I’d like to open and account
  • I’d like to open a bronze account
  • I’d like to open an account and pay monthly
  • I’d like to open a bronze account and pay monthly

Assuming our changes went well the above sentences will work and guide the user toward the endpoint regardless of what information they provide in the first utterance. The completed #Open_Account node should look like the below image, if you have any problems I have included a completed workspace that can be imported to double check against your own.

ICM Watson Conversations Slots 4

Although only a basic example I hope you can see just how powerful a feature Slots are within IBM Watson Conversations service. Extending this approach to 5, 6 or 7 pieces of information would be quick and easy to maintain, my only word or warning is that collecting a lot of information will quickly become a arduous task for users and is better handled with traditional forms.