Documentation Index Fetch the complete documentation index at: https://docs.sleak.chat/llms.txt
Use this file to discover all available pages before exploring further.
n8n community node beschikbaar Voor low-code integraties kun je gebruik maken van onze n8n community node . Dit maakt het eenvoudig om Sleak te integreren in je automatiseringsworkflows.
Authenticatie
De Sleak API gebruikt Bearer token authenticatie. Voeg je API key toe aan de Authorization header:
Authorization: Bearer YOUR_API_KEY
Je kunt je API key vinden in het dashboard onder Instellingen > API .
Base URL
https://api.v1.sleak.chat
Endpoints
De API biedt de volgende endpoints:
POST /api/conversation Start een nieuwe conversatie met een chatbot
POST /api/message Verstuur een bericht binnen een bestaande conversatie
Rate Limiting
De API hanteert rate limiting om overbelasting te voorkomen. Rate limit informatie wordt teruggegeven in de response headers:
X-RateLimit-Limit: Maximaal aantal requests per minuut
X-RateLimit-Remaining: Aantal resterende requests
X-RateLimit-Reset: Unix timestamp wanneer de rate limit reset
Bij het overschrijden van de rate limit ontvang je een 429 Too Many Requests response.
Error Handling
Alle errors worden geretourneerd in het volgende format:
{
"error" : {
"code" : "error_code" ,
"message" : "Foutbeschrijving" ,
"details" : {}
}
}
HTTP Status Codes:
200: Succesvol verwerkt
400: Ongeldige aanvraag
401: Niet geautoriseerd
403: Geen toegang tot deze resource
404: Resource niet gevonden
429: Rate limit overschreden
500: Interne server fout
Code Voorbeelden
cURL
# Start een conversatie
curl -X POST https://api.v1.sleak.chat/api/conversation \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"chatbot_id": "chatbot_123", "visitor_id": "visitor_456"}'
# Verstuur een bericht
curl -X POST https://api.v1.sleak.chat/api/message \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"conversation_id": "conv_789", "message": "Hallo!"}'
Python
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.v1.sleak.chat"
headers = {
"Authorization" : f "Bearer { API_KEY } " ,
"Content-Type" : "application/json"
}
# Start conversatie
response = requests.post(
f " { BASE_URL } /api/conversation" ,
headers = headers,
json = { "chatbot_id" : "chatbot_123" , "visitor_id" : "visitor_456" }
)
conversation_id = response.json()[ "conversation_id" ]
# Verstuur bericht
response = requests.post(
f " { BASE_URL } /api/message" ,
headers = headers,
json = { "conversation_id" : conversation_id, "message" : "Hallo!" }
)
messages = response.json()
JavaScript (Node.js)
const axios = require ( 'axios' );
const API_KEY = 'YOUR_API_KEY' ;
const BASE_URL = 'https://api.v1.sleak.chat' ;
const headers = {
'Authorization' : `Bearer ${ API_KEY } ` ,
'Content-Type' : 'application/json'
};
// Start conversatie
const conversation = await axios . post (
` ${ BASE_URL } /api/conversation` ,
{ chatbot_id: 'chatbot_123' , visitor_id: 'visitor_456' },
{ headers }
);
const conversationId = conversation . data . conversation_id ;
// Verstuur bericht
const response = await axios . post (
` ${ BASE_URL } /api/message` ,
{ conversation_id: conversationId , message: 'Hallo!' },
{ headers }
);