Javascript library to display flowise chatbot on your website
npm install flowise-embedJavascript library to display flowise chatbot on your website
Install:
``bash`
yarn install
Dev:
`bash`
yarn dev
A development server will be running on http://localhost:5678 automatically. Update public/index.html to connect directly to Flowise:
`html`
Build:
`bash`
yarn build
`html`
`html`
To enable full screen, add margin: 0 to body style, and confirm you don't set height and width
`html`
You can also customize chatbot with different configuration
`html`
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:
- Enhanced Security: Conceals your Flowise API host and chatflow IDs from client-side exposure
- Access Control: Implements strict domain-based restrictions for chatbot embedding
- Secure Communication: Acts as a secure gateway for all interactions between your website and Flowise instance
- Authentication Management: Handles API key authentication securely on the server side, away from client exposure
This proxy server can be deployed to any Node.js hosting platform.
1. Configure environment:
`bashCopy .env.example to .env and configure required settings:
API_HOST=https://your-flowise-instance.com
FLOWISE_API_KEY=your-api-key
2. Install dependencies: (assuming you did not run
yarn install yet)`bash
yarn install
`3. Start proxy server:
`bash
yarn start
Server will be available at:
- Local: http://localhost:3001
- Cloud: [Your Platform URL] (e.g., https://your-app.herokuapp.com)
`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:
`html
`5. (optional) If you want to test any identifier in public/index.html, you can update it as below:
`html
chatflowid: 'your-identifier-here' // Must match an identifier from your .env
`Important Notes:
- 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.
- Wildcard domains (\*) are not supported for security reasons
- Identifiers are case-insensitive (e.g., 'Support' and 'support' are treated the same)
Cloud Deployment Requirements
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.
Development Mode (For Local Testing)
1. Configure your environment variables (see above)
2. Start the proxy server:
`bash
yarn start
Server will be available at:
- Local: http://localhost:3001
`3. Update the test page configuration:
- Open
public/index.html in your code editor
- Modify the chatflowid and apiHost to match your .env settings:`html
`For full page testing, use this configuration instead:
`html
`4. While the proxy server is running, open a new terminal and start the development server:
`bash
yarn dev
This will serve the test page on http://localhost:5678 automatically
``5. Test the chatbot:
- Navigate to http://localhost:5678
- The chatbot should now be visible and functional
Note: The development URL (http://localhost:5678) is automatically added to allowed domains in development mode. You don't need to add it manually.
Source code in this repository is made available under the MIT License.