Install and use Rasa Webchat as a React component
masterTo use the widget in a React application, install the package via npm and import the Widget component.
Key Props:
initPayload: The initial message sent to the bot (e.g.,/get_started).socketUrl: The URL of your socket server.socketPath: The path to the socket.io endpoint.customData: An object containing arbitrary data to be sent over the socket. Keep this minimal.title: The title displayed in the widget.embedded: Set this prop totrueif you want to hide the launcher icon and show the widget directly.
npm install rasa-webchatimport Widget from 'rasa-webchat';
function CustomWidget = () => {
return (
<Widget
initPayload={"/get_started"}
socketUrl={"http://localhost:5500"}
socketPath={`/socket.io/`}
customData={{"language": "en"}} // arbitrary custom data. Stay minimal as this will be added to the socket
title={"Title"}
/>
)
}