Start een nieuwe conversatie
curl --request POST \
--url https://api.v1.sleak.chat/api/conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatbot_id": "b88e1147-d2ce-407e-8646-5a7c08ecaebc",
"contact_id": "c428c263-a1d3-4072-bf64-525cefbfb0b1",
"external_id": "order-12345",
"user_name": "Jan Jansen",
"user_email": "[email protected]",
"user_phone": "+31612345678"
}
'import requests
url = "https://api.v1.sleak.chat/api/conversation"
payload = {
"chatbot_id": "b88e1147-d2ce-407e-8646-5a7c08ecaebc",
"contact_id": "c428c263-a1d3-4072-bf64-525cefbfb0b1",
"external_id": "order-12345",
"user_name": "Jan Jansen",
"user_email": "[email protected]",
"user_phone": "+31612345678"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatbot_id: 'b88e1147-d2ce-407e-8646-5a7c08ecaebc',
contact_id: 'c428c263-a1d3-4072-bf64-525cefbfb0b1',
external_id: 'order-12345',
user_name: 'Jan Jansen',
user_email: '[email protected]',
user_phone: '+31612345678'
})
};
fetch('https://api.v1.sleak.chat/api/conversation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.v1.sleak.chat/api/conversation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatbot_id' => 'b88e1147-d2ce-407e-8646-5a7c08ecaebc',
'contact_id' => 'c428c263-a1d3-4072-bf64-525cefbfb0b1',
'external_id' => 'order-12345',
'user_name' => 'Jan Jansen',
'user_email' => '[email protected]',
'user_phone' => '+31612345678'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.v1.sleak.chat/api/conversation"
payload := strings.NewReader("{\n \"chatbot_id\": \"b88e1147-d2ce-407e-8646-5a7c08ecaebc\",\n \"contact_id\": \"c428c263-a1d3-4072-bf64-525cefbfb0b1\",\n \"external_id\": \"order-12345\",\n \"user_name\": \"Jan Jansen\",\n \"user_email\": \"[email protected]\",\n \"user_phone\": \"+31612345678\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.v1.sleak.chat/api/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatbot_id\": \"b88e1147-d2ce-407e-8646-5a7c08ecaebc\",\n \"contact_id\": \"c428c263-a1d3-4072-bf64-525cefbfb0b1\",\n \"external_id\": \"order-12345\",\n \"user_name\": \"Jan Jansen\",\n \"user_email\": \"[email protected]\",\n \"user_phone\": \"+31612345678\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.v1.sleak.chat/api/conversation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatbot_id\": \"b88e1147-d2ce-407e-8646-5a7c08ecaebc\",\n \"contact_id\": \"c428c263-a1d3-4072-bf64-525cefbfb0b1\",\n \"external_id\": \"order-12345\",\n \"user_name\": \"Jan Jansen\",\n \"user_email\": \"[email protected]\",\n \"user_phone\": \"+31612345678\"\n}"
response = http.request(request)
puts response.read_body{
"conversation_id": "5fc020e6-d603-4069-890e-a231c8e9003c",
"contact_id": "c428c263-a1d3-4072-bf64-525cefbfb0b1"
}{
"detail": "Invalid API key"
}{
"detail": "Invalid API key"
}{
"detail": "Organization subscription is not active"
}{
"detail": "Invalid API key"
}{
"detail": [
{
"type": "literal_error",
"loc": [
"body",
"attachments",
0,
"type"
],
"msg": "Input should be 'image'"
}
]
}{
"detail": {
"error": "Rate limit exceeded",
"message": "Too many requests. Please try again later.",
"limit": 100,
"remaining": 0,
"reset": "2023-11-07T05:31:56Z",
"retry_after": 42
}
}{
"detail": "Invalid API key"
}API Reference
Start een conversatie
Creëert een nieuwe chatconversatie met de opgegeven chatbot
POST
/
api
/
conversation
Start een nieuwe conversatie
curl --request POST \
--url https://api.v1.sleak.chat/api/conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatbot_id": "b88e1147-d2ce-407e-8646-5a7c08ecaebc",
"contact_id": "c428c263-a1d3-4072-bf64-525cefbfb0b1",
"external_id": "order-12345",
"user_name": "Jan Jansen",
"user_email": "[email protected]",
"user_phone": "+31612345678"
}
'import requests
url = "https://api.v1.sleak.chat/api/conversation"
payload = {
"chatbot_id": "b88e1147-d2ce-407e-8646-5a7c08ecaebc",
"contact_id": "c428c263-a1d3-4072-bf64-525cefbfb0b1",
"external_id": "order-12345",
"user_name": "Jan Jansen",
"user_email": "[email protected]",
"user_phone": "+31612345678"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatbot_id: 'b88e1147-d2ce-407e-8646-5a7c08ecaebc',
contact_id: 'c428c263-a1d3-4072-bf64-525cefbfb0b1',
external_id: 'order-12345',
user_name: 'Jan Jansen',
user_email: '[email protected]',
user_phone: '+31612345678'
})
};
fetch('https://api.v1.sleak.chat/api/conversation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.v1.sleak.chat/api/conversation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatbot_id' => 'b88e1147-d2ce-407e-8646-5a7c08ecaebc',
'contact_id' => 'c428c263-a1d3-4072-bf64-525cefbfb0b1',
'external_id' => 'order-12345',
'user_name' => 'Jan Jansen',
'user_email' => '[email protected]',
'user_phone' => '+31612345678'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.v1.sleak.chat/api/conversation"
payload := strings.NewReader("{\n \"chatbot_id\": \"b88e1147-d2ce-407e-8646-5a7c08ecaebc\",\n \"contact_id\": \"c428c263-a1d3-4072-bf64-525cefbfb0b1\",\n \"external_id\": \"order-12345\",\n \"user_name\": \"Jan Jansen\",\n \"user_email\": \"[email protected]\",\n \"user_phone\": \"+31612345678\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.v1.sleak.chat/api/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatbot_id\": \"b88e1147-d2ce-407e-8646-5a7c08ecaebc\",\n \"contact_id\": \"c428c263-a1d3-4072-bf64-525cefbfb0b1\",\n \"external_id\": \"order-12345\",\n \"user_name\": \"Jan Jansen\",\n \"user_email\": \"[email protected]\",\n \"user_phone\": \"+31612345678\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.v1.sleak.chat/api/conversation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatbot_id\": \"b88e1147-d2ce-407e-8646-5a7c08ecaebc\",\n \"contact_id\": \"c428c263-a1d3-4072-bf64-525cefbfb0b1\",\n \"external_id\": \"order-12345\",\n \"user_name\": \"Jan Jansen\",\n \"user_email\": \"[email protected]\",\n \"user_phone\": \"+31612345678\"\n}"
response = http.request(request)
puts response.read_body{
"conversation_id": "5fc020e6-d603-4069-890e-a231c8e9003c",
"contact_id": "c428c263-a1d3-4072-bf64-525cefbfb0b1"
}{
"detail": "Invalid API key"
}{
"detail": "Invalid API key"
}{
"detail": "Organization subscription is not active"
}{
"detail": "Invalid API key"
}{
"detail": [
{
"type": "literal_error",
"loc": [
"body",
"attachments",
0,
"type"
],
"msg": "Input should be 'image'"
}
]
}{
"detail": {
"error": "Rate limit exceeded",
"message": "Too many requests. Please try again later.",
"limit": 100,
"remaining": 0,
"reset": "2023-11-07T05:31:56Z",
"retry_after": 42
}
}{
"detail": "Invalid API key"
}Dit endpoint begint een nieuwe conversatie met een specifieke chatbot. Je ontvangt een
conversation_id terug die je kunt gebruiken om berichten te versturen.Authorizations
Gebruik je API sleutel als Bearer token.
Voorbeeld: Authorization: Bearer <jouw-api-sleutel>
Body
application/json
Unieke identifier van de chatbot
Example:
"b88e1147-d2ce-407e-8646-5a7c08ecaebc"
Optionele UUID voor het contact. Als deze niet wordt opgegeven, wordt automatisch een nieuwe ID gegenereerd. Een bestaand contact moet tot dezelfde organisatie als de chatbot behoren.
Example:
"c428c263-a1d3-4072-bf64-525cefbfb0b1"
Optionele identifier uit je eigen systeem, opgeslagen bij de conversatie
Example:
"order-12345"
Optionele naam van het contact
Example:
"Jan Jansen"
Optioneel e-mailadres van het contact
Example:
Optioneel telefoonnummer van het contact
Example:
"+31612345678"

