[英]How to use and control IBM carbon components inside Watson Assistant web chat?
Currently, I am working on a chatbot using Watson assistant, and I want to ask how I can use the IBM carbon components inside the chatbot interface by using it in the dialog responses and have control over them, and also how I can make a connection between a user iframe inside the chatbot so that I can get a specific action on the dialog flow when the user interacts with the embedded iframe.目前,我正在使用 Watson 助手开发聊天机器人,我想问一下如何通过在对话响应中使用聊天机器人界面中的 IBM carbon 组件并控制它们,以及如何建立连接在聊天机器人内部的用户 iframe 之间,以便当用户与嵌入式 iframe 交互时,我可以在对话流中执行特定操作。
You can use user_defined
responses ( https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-render#user_defined_responses ) to display Carbon components.您可以使用
user_defined
响应 ( https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-render#user_defined_responses ) 来显示 Carbon 组件。 You don't need to include the carbon CSS (web chat already includes it) just the right class names on the HTML. There is an example of doing this using React at https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=tutorials-react-portals .您不需要在 HTML 上包含碳 CSS(网络聊天已经包含它),只需包含正确的 class 名称即可。在https://web-chat.global.assistant.watson 上有一个使用 React 执行此操作的示例。 cloud.ibm.com/docs.html?to=tutorials-react-portals 。
For two way communication between an iframe and web chat you will also need to use a user_defined
response and make use of https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage .对于 iframe 和 web 聊天之间的双向通信,您还需要使用用户定义的响应并使用
user_defined
://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage 。 This will only work with iFrame content you control.这仅适用于您控制的 iFrame 内容。 If the iFrame is controlled by a third party, you will have to make use of any APIs they provide.
如果 iFrame 由第三方控制,您将不得不使用他们提供的任何 API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.