copyright | lastupdated | subcollection | content-type | account-plan | completion-time | ||
---|---|---|---|---|---|---|---|
|
2021-05-21 |
assistant |
tutorial |
lite |
10m |
{:shortdesc: .shortdesc} {:new_window: target="_blank"} {:external: target="_blank" .external} {:deprecated: .deprecated} {:important: .important} {:note: .note} {:tip: .tip} {:pre: .pre} {:codeblock: .codeblock} {:screen: .screen} {:javascript: .ph data-hd-programlang='javascript'} {:java: .ph data-hd-programlang='java'} {:python: .ph data-hd-programlang='python'} {:swift: .ph data-hd-programlang='swift'} {:hide-dashboard: .hide-dashboard} {:download: .download} {:video: .video} {:step: data-tutorial-type='step'}
{: #gs-actions} {: toc-content-type="tutorial"} {: toc-completion-time="10m"}
In this short tutorial, we help you use an actions skill to build your first conversation. {: shortdesc}
An actions skill contains actions that represent the tasks you want your assistant to help your customers with.
{: #gs-actions-prerequisites} {: hide-dashboard}
This tutorial is a continuation of the Getting started tutorial. Be sure to complete it before you continue. See Getting started.
{: #gs-actions-add-action-hello} {: step}
Each action contains a series of steps that represent individual exchanges with a customer. In the first action step, you define the user goal that the action will satisfy.
-
Click Create a new action.
-
We are going to keep it simple and just exchange greetings with the customer.
To recognize when a customer is just saying hello, add some examples of ways in which a person might do so.
Add the following examples:
Hi
Hello
Good morning.
Good afternoon!
Good evening
Howdy!
Yo, what's up?
-
Notice that the action has been given a name automatically. Our first example was used to name the skill
Hi
. Let's change it.In the field at the start of the page, change
Hi
toHello
. -
Click Save to save your action.
{: #gs-actions-add-step-hello} {: step}
In the step you add, you'll define the greeting that your assistant will return to the customer.
-
In the navigation pane, click New step.
-
In the Assistant says field, enter
Good day to you!
Because we want to end the exchange of greetings there, let's end the action without adding any more steps.
-
In the And then field, choose End the action.
-
Click Save.
Congratulations! You created a simple turn in a conversation. Now, let's see if it works.
{: #gs-actions-test-say-hello} {: step}
You test the action by entering a salutation into the "Preview" pane, which simulates what the customer's experience would be if they were interacting with the assistant.
-
In the text field of the "Preview" pane, type
hello there
, and then submit it.You are submitting a greeting that doesn't exactly match any of the training examples you added earlier. However, the examples you provided should have taught your assistant to understand what a typical greeting looks like.
The assistant responds with
Good day to you!
The preview also identifies the action that was recognized, by returning Hello.
You did it!
Next, we'll add an action that understands when a customer says goodbye.
{: #gs-actions-add-action-goodbye} {: step}
Let's make sure your assistant is able to say goodbye to your customers when appropriate. We will add a new action that can understand customer messages that aim to end the conversation.
-
Click Close to exit the Say hello action that you created successfully.
You are returned to a page where you can see your new Hello action listed in an Actions table.
-
Minimize the "Preview" panel, and then click New action.
-
Add examples of phrases that customers might use to indicate that they want to end the conversation.
Add the following examples:
Goodbye
I'm all set now.
Thanks.
Have a good day
Thank you for your help
I'm done.
Bye
This time, the action is named Goodbye
, which is a good name, so we won't bother changing it.
{: #gs-actions-add-step-goodbye} {: step}
-
In the navigation pane, click New step.
-
In the Assistant says field, enter
Farewell!
Again, let's end the action without adding any more steps.
-
In the And then field, choose End the action.
-
Click Save.
{: #gs-actions-test-say-goodbye} {: step}
Let's make sure the action is able to recognize when a customer wants to end the conversation.
-
Click Preview to open the "Preview" panel.
-
In the text field, type
I'm finished
, and then submit it.The assistant responds with
Farewell!
and indicates that it recognized the Goodbye action. -
Click Close.
You have successfully created two actions that understand two different customer intentions and can respond to them properly.
{: #gs-actions-integrate-assistant} {: step}
Now that you have an actions skill that can maintain a simple conversational exchange, let's see how it works in the assistant.
-
Click the Assistants icon to open a list of your assistants.
-
Find the My first assistant assistant, and open it.
-
Click Preview to open the Preview page, which shows your assistant embedded in a simple IBM-hosted web page.
You can also use the URL displayed under Share this link to preview the assistant from another browser window or another computer. Previewing the assistant using this URL might incur charges, depending on your service plan. For more information, see Testing your assistant. {: note}
-
In the "Assistant preview" pane, type
hello
into the text field. Press Enter, and watch your assistant respond.You can share the URL with others who might want to try out your assistant.
-
After testing, click the X to close the Preview page.
{: #gs-actions-next-steps}
This tutorial is built around a simple example. For a real application, you need to define some more complex exchanges. When you have a polished version of the assistant, you can integrate it with web sites or channels, such as Slack, that your customers already use. As traffic increases between the assistant and your customers, you can use the tools that are provided in the Analytics page to analyze real conversations, and identify areas for improvement.
- Check out more sample apps to get ideas.