You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -50,15 +53,7 @@ About images: `width` and `height` define the size in pixels that images in mess
50
53
It is recommended to use a particular version (i.e. "webchat-<version>.js") however the file "webchat-latest.js"
51
54
is also available and is updated continuously with the latest version.
52
55
53
-
#### Session Persistence
54
-
55
-
`storage` specifies the location where the the conversation and state of the WebChat is stored in the browser's storage.
56
-
57
-
`storage: "session"` defines the state to be stored in the session storage. The session storage persists on reload of the page, and is cleared after the browser or tab is closed, or when `sessionStorage.clear()`is called.
58
-
59
-
`storage: "local"` defines the state to be stored in the local stoage. The local storage persists after the the browser is closed, and is cleared when the cookies of the browser are cleared, or when `localStorage.clear()`is called.
60
-
61
-
#### As a React component
56
+
### As a React component
62
57
63
58
Install the package from GitHub by running:
64
59
```bash
@@ -98,9 +93,14 @@ function CustomWidget = () => {
98
93
- Make sure to have the prop `embedded`
99
94
set to `true` if you don't want to see the launcher.
100
95
101
-
## In your backend.
96
+
### Backend
97
+
98
+
#### Rasa Core
99
+
100
+
Use the SocketIOInput channel: See [instructions in the Rasa Core documentation](https://rasa.com/docs/core/connectors/#socketio-connector)
102
101
103
-
Your backend should expose a socket with [socket.io](http://socket.io)
102
+
#### Others
103
+
Your backend must expose a socket with [socket.io](http://socket.io)
104
104
105
105
### Receiving messages from the chat
106
106
@@ -112,13 +112,13 @@ Your backend should expose a socket with [socket.io](http://socket.io)
112
112
113
113
### Sending messages from the backend to the chat widget
Admittedly a bit far fetched, thinking that Snippets would evolve to carousels
136
136
of generic templates :)
@@ -157,7 +157,7 @@ message = {
157
157
emit('bot_uttered', message, room=socket_id)
158
158
```
159
159
160
-
#### sending a Video Message
160
+
#####sending a Video Message
161
161
162
162
```python
163
163
message = {
@@ -172,7 +172,7 @@ message = {
172
172
emit('bot_uttered', message, room=socket_id)
173
173
```
174
174
175
-
#### sending an Image Message
175
+
#####sending an Image Message
176
176
177
177
```python
178
178
message = {
@@ -186,9 +186,19 @@ message = {
186
186
}
187
187
emit('bot_uttered', message, room=socket_id)
188
188
```
189
-
#### Using with Rasa
190
-
The chat widget can communicate with any backend, but there is a [Rasa core channel
191
-
available here](https://github.com/mrbot-ai/rasa-addons/)
189
+
190
+
191
+
## Usage
192
+
193
+
### Session Persistence
194
+
195
+
`storage` specifies the location where the the conversation and state of the WebChat is stored in the browser's storage.
196
+
197
+
`storage: "session"` defines the state to be stored in the session storage. The session storage persists on reload of the page, and is cleared after the browser or tab is closed, or when `sessionStorage.clear()`is called.
198
+
199
+
`storage: "local"` defines the state to be stored in the local stoage. The local storage persists after the the browser is closed, and is cleared when the cookies of the browser are cleared, or when `localStorage.clear()`is called.
0 commit comments