vania-janet/multiturn-rag-retrieval-data huggingface dataset:
* If your web chat integration connects to a Salesforce service desk, then you must edit the API call that is included in the code snippet that you added to the Visualforce Page that you created in Salesforce. From Salesforce, search for Visualforce Pages, and find your page. In the <iframe> snippet that you pasted into the page, make the following change:

Replace: src=“https://assistant-integrations-{location}.watsonplatform.net/public/salesforceweb” with a url with this syntax:

src="https://integrations.{location}.assistant.watson.appdomain.cloud/public/salesforceweb/{integration-id}/agent_application?version=2020-09-24"

From the Web chat integration Salesforce live agent setup page, find the Visualforce page markup field. Look for the src parameter in the <iframe> element. It contains the full URL to use, including the appropriate {location} and {integration-id} values for your instance.
* For a Slack integration that is over 7 months old, make sure the Request URL is using the proper endpoint.



* Go to the [Slack API](https://api.slack.com/) web page. Click Your Apps to find your assistant app. Click Event Subscriptions from the navigation pane.
* Edit the Request URL.



For example, if the URL has the syntax: https://assistant-slack-{location}.watsonplatform.net/public/message, change it to have this syntax:

https://integrations.{location}.assistant.watson.appdomain.cloud/public/slack/{integration-id}/message?version=2020-09-24

Check the Generated request URL field in the Slack integration setup page for the full URL to use, which includes the appropriate {location} and {integration-id} values for your instance.
* For a Facebook Messenger integration that is over 7 months old, make sure the Callback URL is using the proper endpoint.
* [Send a message to a WebSocket](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_websocketsend-websocket)



[Creating custom event provider feeds](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfeeds_custom)



* [Feed architecture](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfeeds_arch)



* [Hooks](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfds_hooks)
* [Polling](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfds_polling)
* [Connections](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfds_connections)



* [Implementing feed actions](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfeeds_actions)
* [Implementing feeds with hooks](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfeeds_hooks)
* [Implementing feeds with polling](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfeeds_polling)
* [Implementing feeds by using connections](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-feeds_customfeeds_connections)



[IBM Cloud Monitoring](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-alerts-notifyalerts-notify)



 Watson packages
In your onLoad event handler, use the [on()](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodson) instance method to subscribe to the window:open event, registering the handler as the callback.

instance.on({ type: 'window:open', handler: windowOpenHandler });
3. Create a function that creates the pre-chat form you want to show inside the custom panel. Make sure you resolve the promise when the user closes the panel.

function createOpenPanel(event, instance) {
const customPanel = instance.customPanels.getPanel();
const { hostElement } = customPanel;

hostElement.innerHTML = 
<div class="PreChatForm">
... // Content of pre-chat form
</div>
;

const okButton = hostElement.querySelector('PreChatForm__OkButton')
okButton.addEventListener('click', () => {
customPanel.close();
promiseResolve();
});
}
Show more



A [React version](https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/webchat/examples/pre-post-chat-forms/client/react) of this example is also available.

For complete working code, see [Pre and post-chat forms for Watson Assistant web chat](https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/webchat/examples/pre-post-chat-forms) example.
If you want to perform a one-time action when certain conditions are met during a conversation, use a dialog webhook instead. For more information about the dialog webhook, see [Making a programmatic call from dialog](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-webhooks).

For environments where private endpoints are in use, keep in mind that a webhook sends traffic over the internet.



 Defining the webhook 

You can define one webhook URL to use for processing every message response before it is shared with the customer.

The programmatic call to the external service must meet these requirements:



* The call must be a POST HTTP request.
* The call must be completed in 30 seconds or less.
* The format of the request and response must be in JSON. For example: Content-Type: application/json.



Do not set up and test your webhook in a production environment where the assistant is deployed and is interacting with customers.

To add the webhook details, complete the following steps:



1. From your assistant, click the ![Overflow menu](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/kebab.png) icon, and then choose Settings.
2. Click Webhooks > Post-message webhook.
3. Set the Post-message webhook switch to Enabled.
4. Decide whether to return an error if the webhook call fails.

When enabled, everything stops until the processing step is completed successfully.



* If you have a critical postprocessing step that must be taken before you want to allow the response to be sent to the customer, then enable this setting.
* When this setting is disabled, the assistant ignores any errors it encounters and continues to process the response without taking the processing step. If the postprocessing step is helpful but not critical, consider keeping this setting disabled.



5.
* Response type: Connect to human agent
* Button ID: Z23453e25vv (The button that routes to the insurance experts agent queue)



Conditioned response 2



* Condition: $integrations.chat.browser_info.page_url.contains('invest.html')
* Response type: Connect to human agent
* Button ID: Z23453j24ty (The button that routes to the investment experts agent queue)



For more information about implementing chat transfers, 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). For more information about the contains() SpEL expression method, see [Expression language methods](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methodsdialog-methods-strings-contains).







 Web chat: Reusing the JWT for webhook authentication 

You can use the same JSON Web Token (JWT) that was used to secure your web chat to authenticate webhook calls. If you specify a token in the identityToken property when you add the web chat to your web page, the token is stored in a private variable named context.integrations.chat.private.jwt. For more information about passing a JWT, see [Enable security](https://cloud.ibm.com/docs/assistant?topic=assistant-web-chat-securityweb-chat-security-task).



1. From your dialog skill, open the Options>Webhooks page.
2. Click Add authentication.
3. Without adding any values to the fields in the Basic authorization modal that is displayed, click Save.

An Authorization header is added for you.
4. In the Header value field, add $integrations.chat.private.jwt.
* Service desk agent initials are displayed: When the web chat transfers a user to a service desk agent, the agent's avatar is displayed in the chat window to identify messages sent from the service desk agent. If the agent does not have an avatar, the first initial of the agent's given name is displayed instead.







 2.0 

Release date: 16 June 2020



* Versioning was added to web chat: For more information, see [Versioning](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=key-conceptsversioning).
* Added bidirectional support: You can now use the direction parameter to choose whether to show text and elements in the web chat in right-to-left or left-to-right order. For more information, see [Configuration](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-configuration).
* Introduced the instance.destroySession() method: The instance.destroySession() method removes all cookie and browser storage that is related to the current web chat session. You can use this method as part of your website logout sequence. For more information, see [Instance methods](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodsdestroySession).







 1.5.3 

Release date: 14 April 2020



* The Font family field was removed from the configuration page: The text that is displayed in the chat window uses the fonts: IBMPlexSans, Arial, Helvetica, sans-serif. If you want to use a different set of fonts, you can customize the CSS for your web chat implementation. For more information, see [Theming](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodstheming).
* When your implementation does not specify a unique user ID, the web chat adds a first party cookie with a generated anonymous ID to use to identify the unique user. The generated cookie now expires after 45 days.
[development icon](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/development-icon.png)Example: For a working example that shows how to add custom elements to the home screen, see [Home screen custom elements for Watson Assistant web chat](https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/webchat/examples/home-screen-custom-element).
* To change the home screen style, use [CSS helper classes](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-renderhelper_classes).



Customizing strings
: You can customize the strings that define the various labels and hardcoded phrases displayed by the web chat. To customize strings, use the [updateLanguagePack()](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodsupdatelanguagepack) instance method to replace strings in the current language pack. For more information, see [Languages](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodslanguages).

Supporting global audiences
: By default, the strings displayed by the web chat are in English. To change to a different language, use the [updateLanguagePack()](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodsupdatelanguagepack) instance method to replace the current language pack with one of the available translated language packs. For more information, see [Supporting global audiences](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-web-chat-develop-global).





 Opening, closing, and rendering the web chat window 

Replacing the default launcher
Browser support 

The Watson Assistant application requires the same level of browser software as is required by IBM Cloud. For more information, see [IBM Cloud prerequisites](https://cloud.ibm.com/docs/overview?topic=overview-prereqs-platformbrowsers-platform).

For information about the web browsers that are supported by the web chat integration, see [Browser support](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-web-chat-overviewweb-chat-architecture-browsers).
Integrating with Salesforce 

IBM Cloud

Integrate your web chat with a Salesforce service desk solution so your customers always get the help they need.

Integrate with a Salesforce service desk by deploying your assistant with the web chat integration. The web chat serves as the client interface for your assistant. If, in the course of a conversation with your assistant, a customer asks to speak to a person, you can transfer the conversation directly to a Salesforce agent.

Salesforce is a customer relationship management solution that brings companies and customers together. It is one integrated CRM platform that gives all your departments, including marketing, sales, commerce, and service, a single, shared view of every customer.



 Before you begin 

To connect to a Salesforce service desk, your organization must have a Salesforce Service Cloud plan that supports Live Agent Chat. Chat support is available in Salesforce Service Cloud Unlimited and Enterprise plans. It is also available with Performance or Developer plans that were created after 14 June 2012.

Your organization must have a [Salesforce chat app](https://help.salesforce.com/s/articleView?id=sf.essentials_chat_messaging.htm&type=5) with the following characteristics:



* Console navigation
* Navigation items: Cases, Chat sessions, Chat transcripts
* User profiles: Apply the appropriate profiles to ensure that agents can access the app and view chat history information. You can limit access to this page later. See [Profiles](https://help.salesforce.com/articleView?id=admin_userprofiles.htm&type=5).
* A [chat deployment](https://help.salesforce.com/articleView?id=live_agent_create_deployments.htm&type=5).
* A [chat button deployment](https://help.salesforce.com/articleView?id=live_agent_create_buttons.htm&type=5).
* Routing must be configured for the chat button. See [Chat routing options](https://help.salesforce.com/articleView?id=live_agent_chat_routing_options.htm&type=5).
Tutorial: Setting context variables for actions from the web chat 

This tutorial shows how you can use the web chat to set the values of context variables that your actions can access.

For a complete, working version of the example described in this tutorial, see [Setting context variables for Watson Assistant web chat](https://github.com/watson-developer-cloud/assistant-toolkit/tree/master/integrations/webchat/examples/set-context).

You can use context variables to store information that the assistant uses throughout the conversation.

Context data is maintained throughout the session. The context is sent to the assistant as part of each message, and returned with each response, in an object called context. Context variables for actions skills are stored in the following location:

"context": {
"skills": {
"action skill": {
"skill_variables": {
...
}
}
}
}

Any JSON data can be stored in the skill_variables object and read or modified by either the actions or the web chat.

This example shows how you can store the customer's name in a context variable, which you can then use to show a personalized greeting. You can use this same approach to store any other information that your assistant might use. Examples might include the customer's location, an account balance, or stored preferences.

To set the value of a context variable from the web chat, follow these steps:



1. Create a handler for the [pre:send](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-eventspresend) event. This handler modifies the payload of outgoing message events to assign a value to a context variable called User_Name.

We want to set the user name only once at the beginning of the conversation. This example assumes that the home screen is not enabled, which means that the web chat initiates each new conversation with an empty message to trigger a greeting from the assistant.

For this example, we are using the hardcoded user name Cade. In a production assistant, you might retrieve the customer's name from a user profile on your website.
And you are charged only once when the same anonymous user interacts with your assistant multiple times in a single month.





 Apple devices 

On Apple devices, the Intelligent Tracking Prevention feature automatically deletes any client-side cookie after 7 days. This means that if an anonymous customer accesses your website and then visits again two weeks later, the two visits are treated as two different MAUs.

To avoid this problem, use a server-side first-party cookie in your web application. For example, when an anonymous user visits your website for the first time, you can generate a unique user ID and store it in a server-side cookie with any expiration date you choose. Then, your code can use the [updateUserID()](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodsupdateuserid) instance method to set the user ID. You can then use the same cookie to set the same user ID for this customer on any future visits until it expires.





 More information 

For more information about billing, see [User-based plans explained](https://cloud.ibm.com/docs/assistant?topic=assistant-admin-managing-planadmin-managing-plan-user-based).

For more information about MAU limits per plan, see [Web chat integration limits](https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-web-chatdeploy-web-chat-limits).

For more information about deleting a user's data, see [Labeling and deleting data](https://cloud.ibm.com/docs/assistant?topic=assistant-information-securityinformation-security-gdpr-wa).







 Human agent service integration 

You can configure the web chat to transfer a customer to a human customer support agent if the customer asks for help from a person. The following service desk integrations are supported:

Built-in service desk integrations:
To create a post-chat form, follow the same steps, but subscribe to the window:pre:close event instead of the window:open event.

To display a pre-chat form, follow these steps:



1. Create a handler for the [window:open](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-eventswindowpreopen) event, which is fired when the web chat opens. This handler uses the [customPanels.getPanel()](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-topicid) instance method to open a custom panel that will contain the pre-chat form.

Your handler should return a promise that is resolved when the custom panel is closed. This prevents the web chat window from opening until after the pre-chat form is completed.

function windowOpenHandler(event, instance) {
return new Promise((resolve) => {
// Save a reference to the resolve function so we can resolve
// this promise later.
promiseResolve = resolve;
createOpenPanel(event, instance);

const customPanel = instance.customPanels.getPanel();
customPanel.open({ hidePanelHeader: true,
disableAnimation: true });
});
}
2. In your onLoad event handler, use the [on()](https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methodson) instance method to subscribe to the window:open event, registering the handler as the callback.

instance.on({ type: 'window:open', handler: windowOpenHandler });
3. Create a function that creates the pre-chat form you want to show inside the custom panel. Make sure you resolve the promise when the user closes the panel.

function createOpenPanel(event, instance) {
const customPanel = instance.customPanels.getPanel();
The WebSocket interface 

The WebSocket interface of the IBM Watson® Speech to Text service is the most natural way for a client to interact with the service. To use the WebSocket interface for speech recognition, you first use the /v1/recognize method to establish a persistent connection with the service. You then send text and binary messages over the connection to initiate and manage recognition requests.

Because of their advantages, WebSockets are the preferred mechanism for speech recognition. For more information, see [Advantages of the WebSocket interface](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-service-featuresfeatures-websocket-advantages). For more information about the WebSocket interface and its parameters, see the [API & SDK reference](https://cloud.ibm.com/apidocs/speech-to-text).



 Managing a WebSocket connection 

The WebSocket recognition request and response cycle has the following steps:



1. [Open a connection](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websocketsws-open)
2. [Initiate a recognition request](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websocketsws-start)
3. [Send audio and receive recognition results](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websocketsws-audio)
4. [End a recognition request](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websocketsws-stop)
5. [Send additional requests and modify request parameters](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websocketsws-more)
6.
* Audio: This response type embeds audio from various file formats in the response. A title and description are not displayed, whether or not you specify them. WhatsApp automatically shows a preview of content on supported platforms (such as SoundCloud and Mixcloud).
* Video: This response type embeds a native video from various file formats in the response. A title and description are not displayed, whether or not you specify them. WhatsApp automatically shows a preview of content on supported platforms (such as YouTube and Vimeo).
* The iframe response type is not supported.



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



* A text response that contains more than 1,600 characters is broken up into multiple responses.
* You can upload media files or even documents to the chat. Files shared in the chat can be intercepted and processed by a configured premessage webhook. For more details, see [Processing input attachments](https://cloud.ibm.com/docs/assistant?topic=assistant-api-input-attachments).
* Do not include HTML elements in your text responses.
* The WhatsApp with Twilio integration does not support chat transfers that are initiated with the Connect to human agent response type.
* If you use Markdown syntax, see the Supported Markdown syntax table.
* To include a hypertext link in a text response, specify the url directly. Do not use markdown syntax for links. For example, specify Contact us at https://www.ibm.com.





Supported Markdown syntax

 Format Syntax Example 

 Italics We're talking about _practice_. We're talking about practice. 
 Bold There's no crying in baseball. There's no crying in baseball.