Two ways to connect a LunieAI chatbot to the outside world: embed a visual widget on a website, or call it directly from your own backend or app with an API key. Both are configured from your chatbot's Embed & API page in the dashboard.
For putting a chat window on a website - your own, or a customer's. Visual, visitor-facing, no authentication required. Three flavors: a JavaScript snippet (recommended), a plain iframe, or a WordPress-specific version of the same snippet.
For calling the chatbot from your own backend, a custom app, or a service like Slack or WhatsApp - anywhere that isn't a browser. Requires an API key you generate per chatbot.
Go to Dashboard → your chatbot → Embed & API in the sidebar to reach both. The page has a live preview of the actual widget, and a "Try It" panel that sends a real request through the API using your key - so you can see either integration working before you write any code.
A floating chat bubble your visitors can open from any page on your site.
</body> tag.<!-- Lunie-Ai Chat Widget -->
<script>
(function() {
window.LunieAiConfig = {
chatbotId: '<YOUR_CHATBOT_ID>',
domain: '<YOUR_DOMAIN>',
apiUrl: 'https://lunie.ai'
};
var script = document.createElement('script');
script.src = 'https://lunie.ai/widget.js';
script.async = true;
script.onload = function() {
if (window.LunieAiWidget) window.LunieAiWidget.init(window.LunieAiConfig);
};
document.head.appendChild(script);
})();
</script>
<!-- End Lunie-Ai Chat Widget -->The exact snippet (with your real chatbot ID) is generated for you on the Embed & API page - you don't need to hand-write this.
Works anywhere HTML works, with less customization than the JS widget - a fixed-size chat window rather than a floating bubble.
<iframe
src="https://lunie.ai/widget/<YOUR_CHATBOT_ID>"
width="400"
height="500"
frameborder="0"
style="border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);">
</iframe>Method 1: Custom HTML Widget
Method 2: Theme Customizer
A single endpoint, authenticated with a per-chatbot API key, for calling a chatbot from anywhere that isn't a browser: POST /api/v1/chat/<chatbotId>.
Regenerating a key immediately invalidates the old one - any integration still using it starts getting 401 errors. Revoking disables API access entirely until you generate a new key.
curl -X POST https://lunie.ai/api/v1/chat/<YOUR_CHATBOT_ID> \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"message": "Hello, what can you help me with?"}'const response = await fetch('https://lunie.ai/api/v1/chat/<YOUR_CHATBOT_ID>', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_API_KEY>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ message: 'Hello, what can you help me with?' })
})
const { data } = await response.json()
console.log(data.message)import requests
response = requests.post(
"https://lunie.ai/api/v1/chat/<YOUR_CHATBOT_ID>",
headers={"Authorization": "Bearer <YOUR_API_KEY>"},
json={"message": "Hello, what can you help me with?"}
)
print(response.json()["data"]["message"])message can also be sent as question if you're porting integration code written for another chatbot platform - both are accepted.
Every response includes a conversationId. Pass it back in your next call (as conversationId, or chatId) to continue the same conversation with full context, instead of starting a new one each time.
{
"message": "And what about pricing?",
"conversationId": "62e97f64-db06-45de-91eb-3962c568c592"
}{
"success": true,
"data": {
"message": "The AI's reply, as plain text/markdown",
"conversationId": "uuid - pass this back in to continue the conversation",
"sources": [
{ "title": "...", "source": "...", "score": 0.82, "excerpt": "..." }
],
"metadata": {
"confidence": 0.74,
"processing_time": 1120,
"rag_success": true
}
}
}