Créer une conversation
curl --request POST \
--url https://api.example.com/conversations \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "<string>",
"type": "<string>",
"variables": {
"customer_name": "<string>",
"company": "<string>",
"source": "<string>"
}
}
'import requests
url = "https://api.example.com/conversations"
payload = {
"assistant_id": "<string>",
"type": "<string>",
"variables": {
"customer_name": "<string>",
"company": "<string>",
"source": "<string>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
assistant_id: '<string>',
type: '<string>',
variables: {customer_name: '<string>', company: '<string>', source: '<string>'}
})
};
fetch('https://api.example.com/conversations', 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.example.com/conversations",
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([
'assistant_id' => '<string>',
'type' => '<string>',
'variables' => [
'customer_name' => '<string>',
'company' => '<string>',
'source' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/conversations"
payload := strings.NewReader("{\n \"assistant_id\": \"<string>\",\n \"type\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"company\": \"<string>\",\n \"source\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/conversations")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"<string>\",\n \"type\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"company\": \"<string>\",\n \"source\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"<string>\",\n \"type\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"company\": \"<string>\",\n \"source\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": [
{
"role": "assistant",
"content": "Hello John Smith! Welcome to Acme Corp support. How can I help you today?"
}
]
}
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": []
}
{
"status": false,
"error": "Assistant not found"
}
{
"status": false,
"error": "Insufficient balance. Please top up your account."
}
Chatbot IA
Créer une conversation
Démarrez une nouvelle session de conversation avec un chatbot IA Famulor via l’API. Initialisez le contexte, les métadonnées utilisateur et le canal pour WhatsApp, le chat web ou le chat vocal.
POST
/
conversations
Créer une conversation
curl --request POST \
--url https://api.example.com/conversations \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "<string>",
"type": "<string>",
"variables": {
"customer_name": "<string>",
"company": "<string>",
"source": "<string>"
}
}
'import requests
url = "https://api.example.com/conversations"
payload = {
"assistant_id": "<string>",
"type": "<string>",
"variables": {
"customer_name": "<string>",
"company": "<string>",
"source": "<string>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
assistant_id: '<string>',
type: '<string>',
variables: {customer_name: '<string>', company: '<string>', source: '<string>'}
})
};
fetch('https://api.example.com/conversations', 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.example.com/conversations",
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([
'assistant_id' => '<string>',
'type' => '<string>',
'variables' => [
'customer_name' => '<string>',
'company' => '<string>',
'source' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/conversations"
payload := strings.NewReader("{\n \"assistant_id\": \"<string>\",\n \"type\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"company\": \"<string>\",\n \"source\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/conversations")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"<string>\",\n \"type\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"company\": \"<string>\",\n \"source\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"<string>\",\n \"type\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"company\": \"<string>\",\n \"source\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": [
{
"role": "assistant",
"content": "Hello John Smith! Welcome to Acme Corp support. How can I help you today?"
}
]
}
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": []
}
{
"status": false,
"error": "Assistant not found"
}
{
"status": false,
"error": "Insufficient balance. Please top up your account."
}
API Famulor 1.0 (héritée). Cette page concerne uniquement Famulor 1.0 (
app.famulor.de) et est conservée pour la compatibilité. Pour la plateforme actuelle, consultez la référence API Famulor 2.0.Corps de la requête
string
requis
UUID de l’assistant qui doit gérer la conversation
string
défaut:"widget"
Type de conversation. Options :
widget (payant) ou test (gratuit pour le développement)object
Variables personnalisées injectées dans le contexte de l’assistant (accessibles via
{{variable_name}})Exemples de requête
Champs de réponse
boolean
requis
Indique si la requête a réussi
string
requis
UUID de la conversation créée ; à utiliser pour les messages suivants
array
Exemples de réponse
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": [
{
"role": "assistant",
"content": "Hello John Smith! Welcome to Acme Corp support. How can I help you today?"
}
]
}
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": []
}
{
"status": false,
"error": "Assistant not found"
}
{
"status": false,
"error": "Insufficient balance. Please top up your account."
}
Remarques
- Les conversations
type: "widget"sont facturées ;type: "test"est gratuit pour le développement. - Fournissez des
variablespertinentes pour personnaliser le premier message de l’assistant. - Poursuivez la conversation avec
Envoyer un messageet récupérez l’historique avecRécupérer une conversation.
⌘I