API-referentie
Stel je chatbot vragen vanuit je eigen applicaties, zonder de widget. Business- en Enterprise-plannen.
Authenticatie
Maak per chatbot een sleutel aan onder Instellingen, API. Stuur hem als Bearer-token mee. Houd hem geheim: hij kan je bot aansturen en telt mee voor je daglimiet.
Authorization: Bearer awk_YOUR_KEY
POST /api/v1/chat
Body-velden: bot_id (verplicht), message (verplicht), session_id (optioneel). Geef de session_id uit een vorig antwoord mee om hetzelfde gesprek met volledige geschiedenis voort te zetten.
Antwoord
{
"response": "We are open Monday to Friday, 9 to 5.",
"sources": [{ "title": "Opening hours", "url": "https://yoursite.com/hours" }],
"session_id": "api-7f3c..."
}Limiet: 1000 verzoeken per dag per sleutel. Boven de limiet volgt HTTP 429. Ongeldige of ingetrokken sleutels geven 401.
Voorbeelden
cURL
curl https://ovellan.com/api/v1/chat \
-H "Authorization: Bearer awk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"bot_id":"YOUR_BOT_ID","message":"What are your opening hours?"}'Python
import requests
r = requests.post(
"https://ovellan.com/api/v1/chat",
headers={"Authorization": "Bearer awk_YOUR_KEY"},
json={"bot_id": "YOUR_BOT_ID", "message": "What are your opening hours?"},
)
data = r.json()
print(data["response"])
# pass data["session_id"] back on the next call to continue the conversationJavaScript
const res = await fetch("https://ovellan.com/api/v1/chat", {
method: "POST",
headers: {
"Authorization": "Bearer awk_YOUR_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ bot_id: "YOUR_BOT_ID", message: "What are your opening hours?" }),
});
const data = await res.json();
console.log(data.response);PHP
<?php
$ch = curl_init("https://ovellan.com/api/v1/chat");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer awk_YOUR_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"bot_id" => "YOUR_BOT_ID",
"message" => "What are your opening hours?",
]),
]);
$data = json_decode(curl_exec($ch), true);
echo $data["response"];Webhook (optioneel)
Stel een webhook-URL in op een sleutel in het dashboard. Elk API-verzoek en het bijbehorende antwoord wordt ook als JSON naar die URL gePOST, zodat je gesprekken kunt spiegelen naar je eigen systemen.