thub-embed 10.0.26 → 11.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,353 +1,353 @@
1
- <!-- markdownlint-disable MD030 -->
2
-
3
- # thub Embed
4
-
5
- Javascript library to display thub chatbot on your website
6
-
7
- ![thub](https://github.com/thubAI/thubChatEmbed/blob/main/images/ChatEmbed.gif?raw=true)
8
-
9
- Install:
10
-
11
- ```bash
12
- yarn install
13
- ```
14
-
15
- Dev:
16
-
17
- ```bash
18
- yarn dev
19
- ```
20
-
21
- A development server will be running on http://localhost:5678 automatically. Update `public/index.html` to connect directly to Flowise:
22
-
23
- ```html
24
- <!-- public/index.html -->
25
- <script type="module">
26
- import Chatbot from 'https://localhost:5678/web.js'; // Change to from './web.js' to 'https://localhost:5678/web.js'
27
- Chatbot.init({
28
- chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f', // Add your Flowise chatflowid
29
- apiHost: 'https://your-thub-instance.com', // Add your Flowise apiHost
30
- });
31
- </script>
32
- ```
33
-
34
- Build:
35
-
36
- ```bash
37
- yarn build
38
- ```
39
-
40
- ## Embed in your HTML
41
-
42
- ### PopUp
43
-
44
- ```html
45
- <script type="module">
46
- import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
47
- Chatbot.init({
48
- chatflowid: '<chatflowid>',
49
- apiHost: 'http://localhost:3000',
50
- });
51
- </script>
52
- ```
53
-
54
- ### FullPage
55
-
56
- ```html
57
- <script type="module">
58
- import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
59
- Chatbot.initFull({
60
- chatflowid: '<chatflowid>',
61
- apiHost: 'http://localhost:3000',
62
- });
63
- </script>
64
- <thub-fullchatbot></thub-fullchatbot>
65
- ```
66
-
67
- To enable full screen, add `margin: 0` to <code>body</code> style, and confirm you don't set height and width
68
-
69
- ```html
70
- <body style="margin: 0">
71
- <script type="module">
72
- import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
73
- Chatbot.initFull({
74
- chatflowid: '<chatflowid>',
75
- apiHost: 'http://localhost:3000',
76
- theme: {
77
- chatWindow: {
78
- // height: 700, don't set height
79
- // width: 400, don't set width
80
- },
81
- },
82
- });
83
- </script>
84
- </body>
85
- ```
86
-
87
- ## Configuration
88
-
89
- You can also customize chatbot with different configuration
90
-
91
- ```html
92
- <script type="module">
93
- import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
94
- Chatbot.init({
95
- chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f',
96
- apiHost: 'http://localhost:3000',
97
- chatflowConfig: {
98
- // topK: 2
99
- },
100
- observersConfig: {
101
- // (optional) Allows you to execute code in parent based upon signal observations within the chatbot.
102
- // The userinput field submitted to bot ("" when reset by bot)
103
- observeUserInput: (userInput) => {
104
- console.log({ userInput });
105
- },
106
- // The bot message stack has changed
107
- observeMessages: (messages) => {
108
- console.log({ messages });
109
- },
110
- // The bot loading signal changed
111
- observeLoading: (loading) => {
112
- console.log({ loading });
113
- },
114
- },
115
- theme: {
116
- button: {
117
- backgroundColor: '#3B81F6',
118
- right: 20,
119
- bottom: 20,
120
- size: 48, // small | medium | large | number
121
- dragAndDrop: true,
122
- iconColor: 'white',
123
- customIconSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
124
- autoWindowOpen: {
125
- autoOpen: true, //parameter to control automatic window opening
126
- openDelay: 2, // Optional parameter for delay time in seconds
127
- autoOpenOnMobile: false, //parameter to control automatic window opening in mobile
128
- },
129
- },
130
- tooltip: {
131
- showTooltip: true,
132
- tooltipMessage: 'Hi There 👋!',
133
- tooltipBackgroundColor: 'black',
134
- tooltipTextColor: 'white',
135
- tooltipFontSize: 16,
136
- },
137
- disclaimer: {
138
- title: 'Disclaimer',
139
- message: 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>',
140
- textColor: 'black',
141
- buttonColor: '#3b82f6',
142
- buttonText: 'Start Chatting',
143
- buttonTextColor: 'white',
144
- blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)', //The color of the blurred background that overlays the chat interface
145
- backgroundColor: 'white',
146
- denyButtonText: 'Cancel',
147
- denyButtonBgColor: '#ef4444',
148
- },
149
- customCSS: ``, // Add custom CSS styles. Use !important to override default styles
150
- chatWindow: {
151
- showTitle: true,
152
- showAgentMessages: true,
153
- title: 'Flowise Bot',
154
- titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
155
- titleBackgroundColor: '#3B81F6',
156
- titleTextColor: '#ffffff',
157
- welcomeMessage: 'Hello! This is custom welcome message',
158
- errorMessage: 'This is a custom error message',
159
- backgroundColor: '#ffffff',
160
- backgroundImage: 'enter image path or link', // If set, this will overlap the background color of the chat window.
161
- height: 700,
162
- width: 400,
163
- fontSize: 16,
164
- starterPrompts: ['What is a bot?', 'Who are you?'], // It overrides the starter prompts set by the chat flow passed
165
- starterPromptFontSize: 15,
166
- clearChatOnReload: false, // If set to true, the chat will be cleared when the page reloads
167
- sourceDocsTitle: 'Sources:',
168
- renderHTML: true,
169
- botMessage: {
170
- backgroundColor: '#f7f8ff',
171
- textColor: '#303235',
172
- showAvatar: true,
173
- avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png',
174
- },
175
- userMessage: {
176
- backgroundColor: '#3B81F6',
177
- textColor: '#ffffff',
178
- showAvatar: true,
179
- avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png',
180
- },
181
- textInput: {
182
- placeholder: 'Type your question',
183
- backgroundColor: '#ffffff',
184
- textColor: '#303235',
185
- sendButtonColor: '#3B81F6',
186
- maxChars: 50,
187
- maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.',
188
- autoFocus: true, // If not used, autofocus is disabled on mobile and enabled on desktop. true enables it on both, false disables it on both.
189
- sendMessageSound: true,
190
- // sendSoundLocation: "send_message.mp3", // If this is not used, the default sound effect will be played if sendSoundMessage is true.
191
- receiveMessageSound: true,
192
- // receiveSoundLocation: "receive_message.mp3", // If this is not used, the default sound effect will be played if receiveSoundMessage is true.
193
- },
194
- feedback: {
195
- color: '#303235',
196
- },
197
- dateTimeToggle: {
198
- date: true,
199
- time: true,
200
- },
201
- footer: {
202
- textColor: '#303235',
203
- text: 'Powered by',
204
- company: 'Flowise',
205
- companyLink: 'https://flowiseai.com',
206
- },
207
- },
208
- },
209
- });
210
- </script>
211
- ```
212
-
213
- ## (Experimental) Proxy Server Setup
214
-
215
- The Flowise Embed Proxy Server enhances the security of your chatbot implementation by acting as a protective intermediary layer. This server eliminates the need to expose sensitive Flowise instance details in your frontend code and provides several key security benefits:
216
-
217
- ![Proxy Server](https://github.com/FlowiseAI/FlowiseChatEmbed/blob/main/images/proxyserver.png?raw=true)
218
-
219
- - **Enhanced Security**: Conceals your Flowise API host and chatflow IDs from client-side exposure
220
- - **Access Control**: Implements strict domain-based restrictions for chatbot embedding
221
- - **Secure Communication**: Acts as a secure gateway for all interactions between your website and Flowise instance
222
- - **Authentication Management**: Handles API key authentication securely on the server side, away from client exposure
223
-
224
- This proxy server can be deployed to any Node.js hosting platform.
225
-
226
- ## Quick Start
227
-
228
- 1. Configure environment:
229
-
230
- ```bash
231
- # Copy .env.example to .env and configure required settings:
232
- API_HOST=https://your-thub-instance.com
233
- FLOWISE_API_KEY=your-api-key
234
-
235
- # Configure your chatflows:
236
- # Format: [identifier]=[chatflowId],[allowedDomain1],[allowedDomain2],...
237
- #
238
- # identifier: Any name you choose (e.g., agent1, support, salesbot)
239
- # chatflowId: The UUID of your Flowise chatflow
240
- # allowedDomains: Comma-separated list of domains where this chat can be embedded
241
- #
242
- # Examples:
243
- support=abc123-def456,https://example.com
244
- agent1=xyz789-uvw456,https://sales.example.com
245
- helpdesk=ghi123-jkl456,https://help.example.com,https://support.example.com
246
- ```
247
-
248
- 2. Install dependencies: (assuming you did not run `yarn install` yet)
249
-
250
- ```bash
251
- yarn install
252
- ```
253
-
254
- 3. Start proxy server:
255
-
256
- ```bash
257
- yarn start
258
- # Server will be available at:
259
- # - Local: http://localhost:3001
260
- # - Cloud: [Your Platform URL] (e.g., https://your-app.herokuapp.com)
261
- ```
262
-
263
- 4. Once the proxy server is running in production, you will be able to embed your chatbots safely without exposing your Flowise API host and chatflow IDs as below:
264
-
265
- ```html
266
- <script type="module">
267
- import Chatbot from 'your-proxy-server-url/web.js'; // Must be 'your-proxy-server-url/web.js'
268
- Chatbot.init({
269
- chatflowid: 'your-identifier-here', // Must match an identifier from your .env
270
- apiHost: 'your-proxy-server-url', // Must match the URL of your proxy server
271
- chatflowConfig: {
272
- // ...
273
- },
274
- });
275
- </script>
276
- ```
277
-
278
- 5. (optional) If you want to test any identifier in public/index.html, you can update it as below:
279
-
280
- ```html
281
- <!-- public/index.html -->
282
- chatflowid: 'your-identifier-here' // Must match an identifier from your .env
283
- ```
284
-
285
- **Important Notes:**
286
-
287
- - To ensure secure embedding, you must explicitly whitelist the websites authorized to embed each chatbot. This configuration is done within the .env file. Note that this also applies to your server's URL when deployed to a cloud environment, or http://localhost:3001 for local development, if needed you must whitelist it as well.
288
- - Wildcard domains (\*) are not supported for security reasons
289
- - Identifiers are case-insensitive (e.g., 'Support' and 'support' are treated the same)
290
-
291
- ## Cloud Deployment Requirements
292
-
293
- When deploying to cloud platforms, you must configure the environment variables directly in your platform. The proxy server will not start without these variables being properly set. Compatible with Nixpacks for automatic deployment configuration.
294
-
295
- ## Development Mode (For Local Testing)
296
-
297
- 1. Configure your environment variables (see above)
298
-
299
- 2. Start the proxy server:
300
-
301
- ```bash
302
- yarn start
303
- # Server will be available at:
304
- # - Local: http://localhost:3001
305
- ```
306
-
307
- 3. Update the test page configuration:
308
-
309
- - Open `public/index.html` in your code editor
310
- - Modify the `chatflowid` and `apiHost` to match your `.env` settings:
311
-
312
- ```html
313
- <!-- public/index.html -->
314
- <script type="module">
315
- import Chatbot from './web.js';
316
- Chatbot.init({
317
- chatflowid: 'agent1', // Must match an identifier from your .env
318
- apiHost: 'http://localhost:3001', // Change this from window.location.origin to 'http://localhost:3001'
319
- });
320
- </script>
321
- ```
322
-
323
- For full page testing, use this configuration instead:
324
-
325
- ```html
326
- <!-- public/index.html -->
327
- <thub-fullchatbot></thub-fullchatbot>
328
- <script type="module">
329
- import Chatbot from './web.js';
330
- Chatbot.initFull({
331
- chatflowid: 'agent1', // Must match an identifier from your .env
332
- apiHost: 'http://localhost:3000', // Change this from window.location.origin to 'http://localhost:3001'
333
- });
334
- </script>
335
- ```
336
-
337
- 4. While the proxy server is running, open a new terminal and start the development server:
338
-
339
- ```bash
340
- yarn dev
341
- # This will serve the test page on http://localhost:5678 automatically
342
- ```
343
-
344
- 5. Test the chatbot:
345
-
346
- - Navigate to http://localhost:5678
347
- - The chatbot should now be visible and functional
348
-
349
- **Note:** The development URL (http://localhost:5678) is automatically added to allowed domains in development mode. You don't need to add it manually.
350
-
351
- ## License
352
-
353
- Source code in this repository is made available under the [MIT License](https://github.com/FlowiseAI/Flowise/blob/master/LICENSE.md).
1
+ <!-- markdownlint-disable MD030 -->
2
+
3
+ # thub Embed
4
+
5
+ Javascript library to display thub chatbot on your website
6
+
7
+ ![thub](https://github.com/thubAI/thubChatEmbed/blob/main/images/ChatEmbed.gif?raw=true)
8
+
9
+ Install:
10
+
11
+ ```bash
12
+ yarn install
13
+ ```
14
+
15
+ Dev:
16
+
17
+ ```bash
18
+ yarn dev
19
+ ```
20
+
21
+ A development server will be running on http://localhost:5678 automatically. Update `public/index.html` to connect directly to Flowise:
22
+
23
+ ```html
24
+ <!-- public/index.html -->
25
+ <script type="module">
26
+ import Chatbot from 'https://localhost:5678/web.js'; // Change to from './web.js' to 'https://localhost:5678/web.js'
27
+ Chatbot.init({
28
+ chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f', // Add your Flowise chatflowid
29
+ apiHost: 'https://your-thub-instance.com', // Add your Flowise apiHost
30
+ });
31
+ </script>
32
+ ```
33
+
34
+ Build:
35
+
36
+ ```bash
37
+ yarn build
38
+ ```
39
+
40
+ ## Embed in your HTML
41
+
42
+ ### PopUp
43
+
44
+ ```html
45
+ <script type="module">
46
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
47
+ Chatbot.init({
48
+ chatflowid: '<chatflowid>',
49
+ apiHost: 'http://localhost:3000',
50
+ });
51
+ </script>
52
+ ```
53
+
54
+ ### FullPage
55
+
56
+ ```html
57
+ <script type="module">
58
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
59
+ Chatbot.initFull({
60
+ chatflowid: '<chatflowid>',
61
+ apiHost: 'http://localhost:3000',
62
+ });
63
+ </script>
64
+ <thub-fullchatbot></thub-fullchatbot>
65
+ ```
66
+
67
+ To enable full screen, add `margin: 0` to <code>body</code> style, and confirm you don't set height and width
68
+
69
+ ```html
70
+ <body style="margin: 0">
71
+ <script type="module">
72
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
73
+ Chatbot.initFull({
74
+ chatflowid: '<chatflowid>',
75
+ apiHost: 'http://localhost:3000',
76
+ theme: {
77
+ chatWindow: {
78
+ // height: 700, don't set height
79
+ // width: 400, don't set width
80
+ },
81
+ },
82
+ });
83
+ </script>
84
+ </body>
85
+ ```
86
+
87
+ ## Configuration
88
+
89
+ You can also customize chatbot with different configuration
90
+
91
+ ```html
92
+ <script type="module">
93
+ import Chatbot from 'https://cdn.jsdelivr.net/npm/thub-embed/dist/web.js';
94
+ Chatbot.init({
95
+ chatflowid: '91e9c803-5169-4db9-8207-3c0915d71c5f',
96
+ apiHost: 'http://localhost:3000',
97
+ chatflowConfig: {
98
+ // topK: 2
99
+ },
100
+ observersConfig: {
101
+ // (optional) Allows you to execute code in parent based upon signal observations within the chatbot.
102
+ // The userinput field submitted to bot ("" when reset by bot)
103
+ observeUserInput: (userInput) => {
104
+ console.log({ userInput });
105
+ },
106
+ // The bot message stack has changed
107
+ observeMessages: (messages) => {
108
+ console.log({ messages });
109
+ },
110
+ // The bot loading signal changed
111
+ observeLoading: (loading) => {
112
+ console.log({ loading });
113
+ },
114
+ },
115
+ theme: {
116
+ button: {
117
+ backgroundColor: '#3B81F6',
118
+ right: 20,
119
+ bottom: 20,
120
+ size: 48, // small | medium | large | number
121
+ dragAndDrop: true,
122
+ iconColor: 'white',
123
+ customIconSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
124
+ autoWindowOpen: {
125
+ autoOpen: true, //parameter to control automatic window opening
126
+ openDelay: 2, // Optional parameter for delay time in seconds
127
+ autoOpenOnMobile: false, //parameter to control automatic window opening in mobile
128
+ },
129
+ },
130
+ tooltip: {
131
+ showTooltip: true,
132
+ tooltipMessage: 'Hi There 👋!',
133
+ tooltipBackgroundColor: 'black',
134
+ tooltipTextColor: 'white',
135
+ tooltipFontSize: 16,
136
+ },
137
+ disclaimer: {
138
+ title: 'Disclaimer',
139
+ message: 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>',
140
+ textColor: 'black',
141
+ buttonColor: '#3b82f6',
142
+ buttonText: 'Start Chatting',
143
+ buttonTextColor: 'white',
144
+ blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)', //The color of the blurred background that overlays the chat interface
145
+ backgroundColor: 'white',
146
+ denyButtonText: 'Cancel',
147
+ denyButtonBgColor: '#ef4444',
148
+ },
149
+ customCSS: ``, // Add custom CSS styles. Use !important to override default styles
150
+ chatWindow: {
151
+ showTitle: true,
152
+ showAgentMessages: true,
153
+ title: 'Flowise Bot',
154
+ titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
155
+ titleBackgroundColor: '#3B81F6',
156
+ titleTextColor: '#ffffff',
157
+ welcomeMessage: 'Hello! This is custom welcome message',
158
+ errorMessage: 'This is a custom error message',
159
+ backgroundColor: '#ffffff',
160
+ backgroundImage: 'enter image path or link', // If set, this will overlap the background color of the chat window.
161
+ height: 700,
162
+ width: 400,
163
+ fontSize: 16,
164
+ starterPrompts: ['What is a bot?', 'Who are you?'], // It overrides the starter prompts set by the chat flow passed
165
+ starterPromptFontSize: 15,
166
+ clearChatOnReload: false, // If set to true, the chat will be cleared when the page reloads
167
+ sourceDocsTitle: 'Sources:',
168
+ renderHTML: true,
169
+ botMessage: {
170
+ backgroundColor: '#f7f8ff',
171
+ textColor: '#303235',
172
+ showAvatar: true,
173
+ avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png',
174
+ },
175
+ userMessage: {
176
+ backgroundColor: '#3B81F6',
177
+ textColor: '#ffffff',
178
+ showAvatar: true,
179
+ avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png',
180
+ },
181
+ textInput: {
182
+ placeholder: 'Type your question',
183
+ backgroundColor: '#ffffff',
184
+ textColor: '#303235',
185
+ sendButtonColor: '#3B81F6',
186
+ maxChars: 50,
187
+ maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.',
188
+ autoFocus: true, // If not used, autofocus is disabled on mobile and enabled on desktop. true enables it on both, false disables it on both.
189
+ sendMessageSound: true,
190
+ // sendSoundLocation: "send_message.mp3", // If this is not used, the default sound effect will be played if sendSoundMessage is true.
191
+ receiveMessageSound: true,
192
+ // receiveSoundLocation: "receive_message.mp3", // If this is not used, the default sound effect will be played if receiveSoundMessage is true.
193
+ },
194
+ feedback: {
195
+ color: '#303235',
196
+ },
197
+ dateTimeToggle: {
198
+ date: true,
199
+ time: true,
200
+ },
201
+ footer: {
202
+ textColor: '#303235',
203
+ text: 'Powered by',
204
+ company: 'Flowise',
205
+ companyLink: 'https://flowiseai.com',
206
+ },
207
+ },
208
+ },
209
+ });
210
+ </script>
211
+ ```
212
+
213
+ ## (Experimental) Proxy Server Setup
214
+
215
+ The Flowise Embed Proxy Server enhances the security of your chatbot implementation by acting as a protective intermediary layer. This server eliminates the need to expose sensitive Flowise instance details in your frontend code and provides several key security benefits:
216
+
217
+ ![Proxy Server](https://github.com/FlowiseAI/FlowiseChatEmbed/blob/main/images/proxyserver.png?raw=true)
218
+
219
+ - **Enhanced Security**: Conceals your Flowise API host and chatflow IDs from client-side exposure
220
+ - **Access Control**: Implements strict domain-based restrictions for chatbot embedding
221
+ - **Secure Communication**: Acts as a secure gateway for all interactions between your website and Flowise instance
222
+ - **Authentication Management**: Handles API key authentication securely on the server side, away from client exposure
223
+
224
+ This proxy server can be deployed to any Node.js hosting platform.
225
+
226
+ ## Quick Start
227
+
228
+ 1. Configure environment:
229
+
230
+ ```bash
231
+ # Copy .env.example to .env and configure required settings:
232
+ API_HOST=https://your-thub-instance.com
233
+ FLOWISE_API_KEY=your-api-key
234
+
235
+ # Configure your chatflows:
236
+ # Format: [identifier]=[chatflowId],[allowedDomain1],[allowedDomain2],...
237
+ #
238
+ # identifier: Any name you choose (e.g., agent1, support, salesbot)
239
+ # chatflowId: The UUID of your Flowise chatflow
240
+ # allowedDomains: Comma-separated list of domains where this chat can be embedded
241
+ #
242
+ # Examples:
243
+ support=abc123-def456,https://example.com
244
+ agent1=xyz789-uvw456,https://sales.example.com
245
+ helpdesk=ghi123-jkl456,https://help.example.com,https://support.example.com
246
+ ```
247
+
248
+ 2. Install dependencies: (assuming you did not run `yarn install` yet)
249
+
250
+ ```bash
251
+ yarn install
252
+ ```
253
+
254
+ 3. Start proxy server:
255
+
256
+ ```bash
257
+ yarn start
258
+ # Server will be available at:
259
+ # - Local: http://localhost:3001
260
+ # - Cloud: [Your Platform URL] (e.g., https://your-app.herokuapp.com)
261
+ ```
262
+
263
+ 4. Once the proxy server is running in production, you will be able to embed your chatbots safely without exposing your Flowise API host and chatflow IDs as below:
264
+
265
+ ```html
266
+ <script type="module">
267
+ import Chatbot from 'your-proxy-server-url/web.js'; // Must be 'your-proxy-server-url/web.js'
268
+ Chatbot.init({
269
+ chatflowid: 'your-identifier-here', // Must match an identifier from your .env
270
+ apiHost: 'your-proxy-server-url', // Must match the URL of your proxy server
271
+ chatflowConfig: {
272
+ // ...
273
+ },
274
+ });
275
+ </script>
276
+ ```
277
+
278
+ 5. (optional) If you want to test any identifier in public/index.html, you can update it as below:
279
+
280
+ ```html
281
+ <!-- public/index.html -->
282
+ chatflowid: 'your-identifier-here' // Must match an identifier from your .env
283
+ ```
284
+
285
+ **Important Notes:**
286
+
287
+ - To ensure secure embedding, you must explicitly whitelist the websites authorized to embed each chatbot. This configuration is done within the .env file. Note that this also applies to your server's URL when deployed to a cloud environment, or http://localhost:3001 for local development, if needed you must whitelist it as well.
288
+ - Wildcard domains (\*) are not supported for security reasons
289
+ - Identifiers are case-insensitive (e.g., 'Support' and 'support' are treated the same)
290
+
291
+ ## Cloud Deployment Requirements
292
+
293
+ When deploying to cloud platforms, you must configure the environment variables directly in your platform. The proxy server will not start without these variables being properly set. Compatible with Nixpacks for automatic deployment configuration.
294
+
295
+ ## Development Mode (For Local Testing)
296
+
297
+ 1. Configure your environment variables (see above)
298
+
299
+ 2. Start the proxy server:
300
+
301
+ ```bash
302
+ yarn start
303
+ # Server will be available at:
304
+ # - Local: http://localhost:3001
305
+ ```
306
+
307
+ 3. Update the test page configuration:
308
+
309
+ - Open `public/index.html` in your code editor
310
+ - Modify the `chatflowid` and `apiHost` to match your `.env` settings:
311
+
312
+ ```html
313
+ <!-- public/index.html -->
314
+ <script type="module">
315
+ import Chatbot from './web.js';
316
+ Chatbot.init({
317
+ chatflowid: 'agent1', // Must match an identifier from your .env
318
+ apiHost: 'http://localhost:3001', // Change this from window.location.origin to 'http://localhost:3001'
319
+ });
320
+ </script>
321
+ ```
322
+
323
+ For full page testing, use this configuration instead:
324
+
325
+ ```html
326
+ <!-- public/index.html -->
327
+ <thub-fullchatbot></thub-fullchatbot>
328
+ <script type="module">
329
+ import Chatbot from './web.js';
330
+ Chatbot.initFull({
331
+ chatflowid: 'agent1', // Must match an identifier from your .env
332
+ apiHost: 'http://localhost:3000', // Change this from window.location.origin to 'http://localhost:3001'
333
+ });
334
+ </script>
335
+ ```
336
+
337
+ 4. While the proxy server is running, open a new terminal and start the development server:
338
+
339
+ ```bash
340
+ yarn dev
341
+ # This will serve the test page on http://localhost:5678 automatically
342
+ ```
343
+
344
+ 5. Test the chatbot:
345
+
346
+ - Navigate to http://localhost:5678
347
+ - The chatbot should now be visible and functional
348
+
349
+ **Note:** The development URL (http://localhost:5678) is automatically added to allowed domains in development mode. You don't need to add it manually.
350
+
351
+ ## License
352
+
353
+ Source code in this repository is made available under the [MIT License](https://github.com/FlowiseAI/Flowise/blob/master/LICENSE.md).