vania-janet/multiturn-rag-retrieval-data huggingface dataset:
The Intents page is where you start to train your assistant. In this tutorial, you will add training data that was built by IBM to your skill. Prebuilt intents are available from the content catalog. You will give your assistant access to the General content catalog so your dialog can greet users, and end conversations with them.



1. Make sure your My first skill is open.
2. Click Content Catalog from the Skills menu.
3. Find General in the list, and then click Add to skill.

![Shows the Content Catalog and highlights the Add to skill button for the General catalog.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/gs-add-content-catalog.png)
4. Open the Intents tab to review the intents and associated example utterances that were added to your training data. You can recognize them because each intent name begins with the prefix General_. You will add the General_Greetings and General_Ending intents to your dialog in the next step.

![Shows the intents that are displayed in the Intents tab after the General catalog is added.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/gs-general-content-added.png)



You successfully started to build your training data by adding prebuilt content from IBM.





 Step 4: Build a dialog 

A [dialog](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview) defines the flow of your conversation in the form of a logic tree. It matches intents (what users say) to responses (what your virtual assistant says back). Each node of the tree has a condition that triggers it, based on user input.
If the assistant or the user enters new input, then the button-generated input disappears. Therefore, if you include multiple response types in a single response, position the option response type last. Otherwise, content from subsequent responses, such as text from a text response type, will replace the button-generated text.
* The title is automatically taken from the text of the relevant step of the action where options are listed.









 Chatting with the assistant 

To start a chat with the assistant, complete the following steps:



1. Open Facebook Messenger.
2. Type the name of the page you created earlier.
3. After the page comes up, click it, and then start chatting with the assistant.



The welcome action is not processed by the Facebook Messenger integration. The welcome message is not displayed in Facebook Messenger like it is in the assistant preview. It is not triggered from here because nodes with the welcome special condition are skipped in action flows that are started by users. Facebook Messenger waits for the user to initiate the conversation.

The action flow for the current session is restarted after 60 minutes of inactivity (5 minutes for Lite and Standard plans). This means that if a user stops interacting with the assistant, after 60 (or 5) minutes, any context variable values that were set during the previous conversation are set to null or back to their default values.

Only the page administrator can interact with the Facebook Messenger chatbot until after it is approved by Facebook. After the chatbot is approved by Facebook, any page visitor can interact with the chatbot.
}
}
Show more

When you define an options list with only 3 items, the options are typically displayed as buttons. When you add a preference property that indicates dropdown as the preference, for example, you can see in the "Try it out" pane that the list is displayed as a drop-down list instead.

![Shows a small options list in the Preview that is displayed as a drop-down menu.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/options-dropdown.png)

Some integration types, such as the web chat, reflect your preference. Other integration types, such as Slack, do not reflect your preference when they render the options.



Do not add more than one option response type to a single dialog node because both lists are displayed at once, but the customer can choose an option from only one of them.

If you need to be able to populate the list of options with different values based on some other factors, you can design a dynamic options list. For more information, see the [How to Dynamically Add Response Options to Dialog Nodes](https://medium.com/ibm-watson/how-to-dynamically-add-response-options-to-dialog-nodes-in-watson-assistant-e14c5e08beca) blog post.





 Adding a Pause response type 

Add a pause response type to give the assistant time to respond. For example, you might add a pause response type to a node that calls a webhook. The pause indicates that the assistant is working on an answer, which gives the assistant time to make the webhook call and get a response. Then, you can jump to a child node to show the result.

To add a Pause response type, complete the following steps:



1. From the dialog node where you want to add the response type, click the dropdown menu in the Assistant responds field, and then choose Pause.
2.
While the website is being crawled and the data indexed, let's go back to our Watson Assistant service instance. It's time to connect the action that we created to this Discovery project.





 Step 5: Add a search extension 

Let's connect your assistant to your Discovery data.



1. From the navigation panel in Watson Assistant, click Environments.

Zoom

![Shows the Environments menu item in the navigation panel.](https://cloud.ibm.com/docs-content/v1/content/f16b1f78a92498247223b337bd9303c2758b9ba8/discovery-data/images/tut-convo-enviro-0.png)

Figure 24. Environment menu

The draft environment is displayed. It shows that a web chat is connected to your assistant.

Zoom

![Shows the draft environment with the web chat connected to the action.](https://cloud.ibm.com/docs-content/v1/content/f16b1f78a92498247223b337bd9303c2758b9ba8/discovery-data/images/tut-convo-enviro-1.png)

Figure 25. Draft environment diagram
2. Click the Web chat tile to edit the web chat.

We don't want to add multiple starter questions, so we are going to turn off the home screen for the web chat. Click the Home screen tab.

Zoom

![Shows the web chat home screen configuration page.](https://cloud.ibm.com/docs-content/v1/content/f16b1f78a92498247223b337bd9303c2758b9ba8/discovery-data/images/tut-convo-enviro-1aa.png)

Figure 26. Web chat home screen configuration
3. Set the switcher to Off, and then click Save and exit.

Zoom

!
[External link icon](https://cloud.ibm.com/docs-content/v1/content/icons/launch-glyph.svg)](https://www.ibm.com/support/knowledgecenter/SSQP8H/iot/platform/devices/device_mgmt/custom_actions.html).



 Adding a custom device management package 

Custom device management packages can be added either by using the Watson IoT Platform dashboard or by using the API.

To add a custom device management package by using the Watson IoT Platform dashboard:



1. From your Watson IoT Platform dashboard, click Settings from the navigation bar.
2. Click Custom Device Management Packages.
3. Click the Add Package button.
4. Select your package file and click Open.



To add a custom device management package by using the API, see the [Watson IoT Platform API documentation ![External link icon](https://cloud.ibm.com/docs-content/v1/content/icons/launch-glyph.svg)](https://docs.internetofthings.ibmcloud.com/apis/swagger/v0002/orgAdmin.html).
From the All Products and Services menu, click Phone Numbers.
9. From the Active Numbers page, click one of your phone numbers. Scroll to the Messaging section, and then find the Webhook field that defines what to do when a message comes in.

Paste the value that you copied from the Webhook URI field into it.
10. If you want to support multiple phone numbers, repeat the previous step for each phone number that you want to use.
11. Click Save and exit.



To watch a video that walks through the setup process, see [Phone and SMS Integration](https://community.ibm.com/community/user/watsonapps/viewdocument/phone-and-sms-integration?CommunityKey=7a3dc5ba-3018-452d-9a43-a49dc6819633&tab=librarydocuments) in the IBM Watson Apps Community.

If you want your assistant to be able to switch between voice and text during a customer interaction, enable both the phone and text messaging integrations. The integrations do not need to use the same third-party service provider. For more information, see [Integrating with phone](https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-phone).





 Advanced configuration options 

Click the Advanced options tab to make any of the following customizations to the messaging behavior:



* Initiate conversation from inbound messages: Disable this option if you want to limit messaging support to allow messages that are sent in the context of an ongoing phone integration conversation only, and not allow customers to start a message exchange with the assistant outside of a phone call.
* Default failure message: Add a message to send to the customer if the SMS connection fails.
* Base URL: This URL is the REST API endpoint for the SMS service you are using.







 Optimize your dialog for messaging 

For the best customer experience, design your dialog with the capabilities of the Twilio integration in mind:



* Do not include HTML elements in your text responses.
* You can send media files or even documents in your response. These files can be intercepted and processed by a configured premessage webhook.
For more information about it, read the [Slack blog post](https://medium.com/slack-developer-blog/more-precision-less-restrictions-a3550006f9c3) about it.
8. Assign bot token scopes to your Slack app. At a minimum, apply the following scopes:



* app_mentions:read
* chat:write
* im:history
* im:read
* im:write



9. Click Install App to Workspace, and then allow the installation when prompted.

If you are editing scopes for an existing application, reinstall it.
10. From the Slack settings App Home page, enable the Always Show My Bot As Online setting.
11. Go to the OAuth and Permissions page in Slack, copy the Bot User OAuth Access Token.
12. From the Watson Assistant Slack integration configuration page, paste the token that you copied in the previous step into both the OAuth access token and Bot user OAuth access token fields.
13. On the Slack app settings page, go to the Basic Information page, and then find the App Credentials section. Copy the app credential verification token.
14. From the Watson Assistant Slack integration configuration page, paste the verification token that you copied in the previous step into the Verification token field.
15. Click Generate request URL, and then copy the generated request URL.
16. Return to the Slack app settings page. Open the Event Subscriptions page, and then turn on Enable Events. Paste the request URL that you copied in the previous step into the field.
17. On the Event Subscriptions page in Slack, find the Subscribe to Bot Events section. Click Add Bot User Event, and then select the event types you want to subscribe to. You must select at least one of the following types:



* message.im: Listens for message events that are posted in a direct message channel.
* app_mention: Listens for only message events that mention your app or bot.

Choose the app_mention entry in normal font, not the app_mention entry that is in bold font.
For more information, see [Adding routing logic for Salesforce transfers](https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-salesforcedeploy-salesforce-routing). 
 Zendesk Department Specify a valid department name from your Zendesk account. For more information, see [Adding routing logic for Zendesk transfers](https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-zendeskdeploy-zendesk-routing). 







The dialog transfer does not occur when you test dialog nodes with this response type in the "Try it out" pane of the dialog skill. You must access a node that uses this response type from the Preview button for the assistant to see how your users will experience it.





 Adding a Channel transfer response type 

If your assistant uses multiple integrations to support different channels for interaction with users, there might be some situations when a customer begins a conversation in one channel but then needs to transfer to a different channel.

The most common such situation is transferring a conversation to the web chat integration, in order to take advantage of web chat features such as service desk integration.

Currently, the web chat is the only supported target for a channel transfer.

Only the following integrations can initiate a channel transfer: - Slack - Facebook Messenger - WhatsApp

Other integrations ignore the Channel transfer response type.

To add a Channel transfer response type, complete the following steps:



1. From the dialog node where you want to add the response type, click the dropdown menu in the Assistant responds field, and then choose Channel transfer.
2. Optional. In the Message before link to web chat field, edit the introductory message to display to the user (in the originating channel) before the link that initiates the transfer. By default, this message is OK, click this link for additional help. Chat will continue on a new web page.
3. In the URL to web chat field, type the URL for your website where the web chat widget is embedded.



In the integration that processes the Channel transfer response, the introductory message is displayed, followed by a link to the URL you specify.
For any dialog nodes that transfer the chat to a service desk agent, add a Connect to human agent response type.

For more information, see [Adding a Connect to human agent response type](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overviewdialog-overview-add-connect-to-human-agent).
2. For any dialog nodes that redirect customers to alternate forms of customer support, add a context variable named context_connect_to_agent and set it to true.

The process that calculates the containment metric looks for instances of this context variable, and registers any occurrences that it finds as interventions.



* From the dialog node, go to the Assistant responds section and click the menu icon ![overflow menu icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/more-icon.png).

If you're using multiple conditioned responses, you must click the Customize response icon ![gear icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/customize-response-icon.png) to see the menu that is associated with the response.
* Click Open context editor.

![Shows the Open context editor menu option selected from the list](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/open-context-editor.png)
* Add the following variable name and value to define the context variable:



Special containment context variable

 Variable Value 

 `context_connect_to_agent` `true` 



* Click X to close the dialog node. Your change is saved automatically.
* Define the action within the context object, not the output object of the dialog node JSON snippet.
* Define only one action or one sequence per conversation turn.
* Do not jump from a dialog node with an action configured for it to another dialog node with an action configured for it.



To enable text messaging-specific actions, you must add a JSON code block to the dialog node where you want the action to trigger.

To add a JSON code block to a dialog node, complete the following steps:



1. From your dialog skill, go to the Dialog page.
2. Open the dialog node where you want to call the action.
3. From the Assistant responds section, click the menu ![Overflow menu](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/more-icon.png), and then choose Open JSON editor.

![Shows the Assistant responds section of a dialog node with the user selecting the Open JSON editor from the options icon.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/open-json-editor.png)
4. Add the action command JSON code block to the context object. (If no context object exists, add one. The context object is a peer to the output object.)

For example:

{
"output": {
"generic": [
]
},
"context": {
"smsAction": {
"command": "<command-name>",
"parameters": {
"<first-parameter>": "<parameter-value>"
}
}
}
}







 Sending multimedia content over text
Add an intent to your skill that can recognize a user's request to speak to a human.

You can create your own intent or add the prebuilt intent named General_Connect_to_Agent that is provided with the General content catalog developed by IBM.
2. Add a root node to your dialog that conditions on the intent that you created in the previous step. Choose Connect to human agent as the response type.
3. Prepare each dialog branch to be triggered by the assistant from the Intercom app.

Every root dialog node in the dialog can be processed by the assistant while it is functioning as an Intercom teammate, including root nodes in folders. You will specify the action that you want the assistant to take for each dialog branch later when you configure the Intercom integration. Therefore, although you cannot hide a node from Intercom, you can configure the assistant to do nothing when the node is triggered.

Fill in the following fields of the root node of each dialog branch:



* Node name: Give the node a name. This name is how you will identify the node when you configure interactions for it later. If you don't add a name, you will have to choose the node based on its node ID instead.
* External node name: Add a summary of the purpose of the dialog branch. For example, Find a store.

This information is shown to other agents on the assistant's team when the assistant offers to answer a user query. If there is more than one dialog node that can address the query, the assistant shares a list of response options with human agent teammates to get their advice about which response to use.

![Screenshot of the field in the node edit view where you add the node purpose summary.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/disambig-node-purpose.png)

Do not add an external node name to the root node that you created in Step 2.
Configure a Slack [incoming webhook](https://api.slack.com/incoming-webhooks) for your team.

After Slack is configured, you get a webhook URL that looks like https://hooks.slack.com/services/aaaaaaaaa/bbbbbbbbb/cccccccccccccccccccccccc. The webhook is needed in the next step.
2. Create a package binding with your Slack credentials, the channel that you want to post to, and the user name to post as.

ibmcloud fn package bind /whisk.system/slack mySlack --param url "https://hooks.slack.com/services/..." --param username "Bob" --param channel "MySlackChannel"
3. Invoke the post action in your package binding to post a message to your Slack channel.

ibmcloud fn action invoke mySlack/post --blocking --result --param text "Hello from OpenWhisk!"







 Using the Slack token-based API 

If you prefer, you can choose to use the Slack token-based API, rather than the webhook API. If you so choose, then pass in a token parameter that contains your Slack [access token](https://api.slack.com/tokens). Then, you can use any of the [Slack API methods](https://api.slack.com/methods) as your url parameter. For example, to post a message, include a url parameter value of [slack.postMessage](https://api.slack.com/methods/chat.postMessage).
(https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/gs-add-content-catalog.png)
3. Open the Intents tab to review the intents and associated example utterances that were added to your training data. You can recognize them because each intent name begins with the prefix General_. You will add the General_Greetings and General_Ending intents to your dialog in the next step.

![Shows the intents that are displayed in the Intents tab after the General catalog is added.](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/gs-general-content-added.png)



You successfully started to build your training data by adding prebuilt content from IBM.





 Step 5: Build a dialog 

A dialog defines the flow of your conversation in the form of a logic tree. It matches intents (what users say) to responses (what the bot says back). Each node of the tree has a condition that triggers it, based on user input.

We'll create a simple dialog that handles greeting and ending intents, each with a single node.



 Adding a start node 



1. From the Skills menu, click Dialog.
2. Two nodes were added to the dialog for you:



* Welcome: Contains a greeting that is displayed to your users when they first engage with the assistant.
* Anything else: Contains phrases that are used to reply to users when their input is not addressed by any of the existing dialog nodes.



!
Where KEY_NAME is the name of the key, and INSTANCE_NAME is the name of the Event Streams instance.

The output of this command includes the details that are needed to make a REST call to send notifications to the Event Streams instance.









 Step 3. Create a notification channel 

From the Monitoring UI, setup a Webhook notification channel.

Complete the following steps to add a notification channel:



1. Launch the web UI. For more information on how to launch the Web UI, see [Navigating to the Web UI](https://cloud.ibm.com/docs/monitoring?topic=monitoring-launchlaunch).
2. Click the user icon. This is the icon with the initials of the logged on user. Then click Settings.
3. Select Notification Channels.
4. Click Add Notification Channel.
5. Configure a notification channel:



1. Select the type of notification, for example, Webhook.
2. Enter the name of the channel.
3. Enable the Notify when Resolved condition to receive a notification when the alert is manually resolved by a user.
4. Enable the Notify when Acknowledged field to receive a notification when the alert is manually acknowledged by the user.
5. For a webhook notification, enter the webhook URL. The format is the following: <kafka_http_url>/topics/<topic>/records?apikey=<api_key>

Where <topic> is the name of your topic.

For example, the URL field can be https://y545tf67898h.svc01.eu-gb.eventstreams.cloud.ibm.com/topics/my-sample-topic/records?apikey=27836238765487558695

When an alert is triggered, the notification is sent as a POST in JSON format to your webhook endpoint.
6. For other notification types, configure the appropriate fields for the notification.
7.