Embed an AI-powered real estate chatbot on any website in minutes
Add this code to your website, just before the closing </body> tag:
Works out of the box. Just configure your API URL and you're done.
Fully responsive design. Works perfectly on phones, tablets, and desktops.
Change bot name, subtitle, colors, and position to match your brand.
Runs in an isolated iframe. No conflicts with host page styles or JavaScript.
Minified bundle. ~15KB script + 23KB HTML. Loads instantly from global CDN.
Pure JavaScript. No jQuery, React, or external libraries required.
Customize the widget behavior with these config properties:
| Property | Type | Required | Description |
|---|---|---|---|
apiUrl |
string | ✅ Yes | Backend API endpoint for chat messages. Must include full path to message endpoint. |
botName |
string | ❌ No | Bot display name. Default: "AI Assistant" |
botSubtitle |
string | ❌ No | Bot subtitle shown under name. Default: "Powered by Leadrat" |
primaryColor |
hex color | ❌ No | Header and button color. Default: "#6C63FF" |
position |
"bottom-right" | "bottom-left" | ❌ No | Widget position on screen. Default: "bottom-right" |
tenantId |
string | ❌ No | Multi-tenant identifier. Default: "dubait11" |
Add to your public/index.html:
Add anywhere on your page (typically before closing body tag):
Add to Theme Editor (Appearance → Theme Editor → footer.php):
The widget sends POST requests to your API endpoint with this format:
Expected response:
1. Check browser console (F12) for errors
2. Verify apiUrl is set correctly in config
3. Check that LeadratChatConfig is set BEFORE the script tag loads
4. Verify script is loaded from correct CDN URL
1. Check Network tab (F12) to see if API requests are being made
2. Verify backend API is running and accessible
3. Check backend CORS settings allow requests from your domain
4. Verify API endpoint returns proper JSON response
The widget uses z-index 999999 and is fixed position. If it's blocking important content:
1. Change position to "bottom-left"
2. Or adjust your page layout
The widget automatically prevents duplicates. Only one instance will be created even if the script is included multiple times.
All files are hosted on Cloudflare Pages global CDN:
| File | URL | Size |
|---|---|---|
| Main Widget Script | leadrat-chat.js |
~15 KB |
| Chat UI (for iframe) | chat-ui.html |
~23 KB |
Both files are automatically loaded from the same CDN origin.
For more information and support: