Générer une réponse IA
curl --request POST \
--url https://app.famulor.de/api/user/ai/generate-reply \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": 123,
"customer_identifier": "<string>",
"message": "<string>",
"variables": {
"customer_name": "<string>",
"source": "<string>",
"order_id": "<string>"
}
}
'import requests
url = "https://app.famulor.de/api/user/ai/generate-reply"
payload = {
"assistant_id": 123,
"customer_identifier": "<string>",
"message": "<string>",
"variables": {
"customer_name": "<string>",
"source": "<string>",
"order_id": "<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: 123,
customer_identifier: '<string>',
message: '<string>',
variables: {customer_name: '<string>', source: '<string>', order_id: '<string>'}
})
};
fetch('https://app.famulor.de/api/user/ai/generate-reply', 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://app.famulor.de/api/user/ai/generate-reply",
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' => 123,
'customer_identifier' => '<string>',
'message' => '<string>',
'variables' => [
'customer_name' => '<string>',
'source' => '<string>',
'order_id' => '<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://app.famulor.de/api/user/ai/generate-reply"
payload := strings.NewReader("{\n \"assistant_id\": 123,\n \"customer_identifier\": \"<string>\",\n \"message\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"source\": \"<string>\",\n \"order_id\": \"<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://app.famulor.de/api/user/ai/generate-reply")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": 123,\n \"customer_identifier\": \"<string>\",\n \"message\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"source\": \"<string>\",\n \"order_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.famulor.de/api/user/ai/generate-reply")
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\": 123,\n \"customer_identifier\": \"<string>\",\n \"message\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"source\": \"<string>\",\n \"order_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"customer_identifier": "+14155551234",
"reply": "Hi John! I'd be happy to help you schedule an appointment. What day and time work best for you?",
"function_calls": [],
"ai_disabled": false
}
{
"success": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"customer_identifier": "+14155551234",
"reply": "I've checked our calendar and we have availability tomorrow at 2 PM and Friday at 10 AM. Which works better for you?",
"function_calls": [
{
"name": "check_availability",
"arguments": {
"start_date": "2025-01-08",
"days": 7
},
"result": {
"slots": ["2025-01-08 14:00", "2025-01-10 10:00"]
}
}
],
"ai_disabled": false
}
{
"success": false,
"error": "Assistant not found or does not belong to you",
"error_code": "ASSISTANT_NOT_FOUND"
}
{
"success": false,
"error": "Insufficient balance. Please top up your account.",
"error_code": "INSUFFICIENT_BALANCE"
}
{
"message": "The assistant id field is required.",
"errors": {
"assistant_id": ["The assistant id field is required."]
}
}
{
"message": "Too Many Attempts.",
"retry_after": 60
}
Réponses IA
Générer une réponse IA
Génère une réponse IA à l’aide d’un assistant, à partir d’un identifiant client
POST
/
api
/
user
/
ai
/
generate-reply
Générer une réponse IA
curl --request POST \
--url https://app.famulor.de/api/user/ai/generate-reply \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": 123,
"customer_identifier": "<string>",
"message": "<string>",
"variables": {
"customer_name": "<string>",
"source": "<string>",
"order_id": "<string>"
}
}
'import requests
url = "https://app.famulor.de/api/user/ai/generate-reply"
payload = {
"assistant_id": 123,
"customer_identifier": "<string>",
"message": "<string>",
"variables": {
"customer_name": "<string>",
"source": "<string>",
"order_id": "<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: 123,
customer_identifier: '<string>',
message: '<string>',
variables: {customer_name: '<string>', source: '<string>', order_id: '<string>'}
})
};
fetch('https://app.famulor.de/api/user/ai/generate-reply', 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://app.famulor.de/api/user/ai/generate-reply",
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' => 123,
'customer_identifier' => '<string>',
'message' => '<string>',
'variables' => [
'customer_name' => '<string>',
'source' => '<string>',
'order_id' => '<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://app.famulor.de/api/user/ai/generate-reply"
payload := strings.NewReader("{\n \"assistant_id\": 123,\n \"customer_identifier\": \"<string>\",\n \"message\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"source\": \"<string>\",\n \"order_id\": \"<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://app.famulor.de/api/user/ai/generate-reply")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": 123,\n \"customer_identifier\": \"<string>\",\n \"message\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"source\": \"<string>\",\n \"order_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.famulor.de/api/user/ai/generate-reply")
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\": 123,\n \"customer_identifier\": \"<string>\",\n \"message\": \"<string>\",\n \"variables\": {\n \"customer_name\": \"<string>\",\n \"source\": \"<string>\",\n \"order_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"customer_identifier": "+14155551234",
"reply": "Hi John! I'd be happy to help you schedule an appointment. What day and time work best for you?",
"function_calls": [],
"ai_disabled": false
}
{
"success": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"customer_identifier": "+14155551234",
"reply": "I've checked our calendar and we have availability tomorrow at 2 PM and Friday at 10 AM. Which works better for you?",
"function_calls": [
{
"name": "check_availability",
"arguments": {
"start_date": "2025-01-08",
"days": 7
},
"result": {
"slots": ["2025-01-08 14:00", "2025-01-10 10:00"]
}
}
],
"ai_disabled": false
}
{
"success": false,
"error": "Assistant not found or does not belong to you",
"error_code": "ASSISTANT_NOT_FOUND"
}
{
"success": false,
"error": "Insufficient balance. Please top up your account.",
"error_code": "INSUFFICIENT_BALANCE"
}
{
"message": "The assistant id field is required.",
"errors": {
"assistant_id": ["The assistant id field is required."]
}
}
{
"message": "Too Many Attempts.",
"retry_after": 60
}
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.Limite de débit : ce point de terminaison est limité à 5 requêtes par minute et par jeton API afin d’éviter les abus.
Corps de la requête
integer
requis
L’ID de l’assistant à utiliser pour générer la réponse. Doit appartenir à votre compte.
string
requis
Un identifiant unique pour le client. Il sert à maintenir le contexte de la conversation à travers plusieurs messages.Exemples : numéro de téléphone, adresse e-mail, identifiant de contact CRM, identifiant utilisateur Facebook.Longueur maximale : 255 caractères.Important : utilisez toujours le même format pour un même client afin que le contexte soit correctement associé.
string
requis
Le message du client auquel répondre.
object
Variables de contexte facultatives à transmettre à l’assistant. Elles sont fusionnées avec les variables de conversation existantes.Utile pour transmettre des données client, le contexte de session ou d’autres métadonnées permettant de personnaliser la réponse.
Champs de réponse
boolean
Indique si la requête a réussi
string
L’UUID de la conversation. Utilisez-le pour suivre ou référencer la conversation ultérieurement.
string
L’identifiant client fourni dans la requête
string
La réponse générée par l’IA au message du client
array
boolean
Indique si les réponses IA sont désactivées pour cette conversation (par ex. en cas de reprise manuelle)
Réponses d’erreur
boolean
Sera
false en cas d’erreurstring
Message d’erreur décrivant le problème rencontré
string
Code d’erreur exploitable par une machine. Valeurs possibles :
ASSISTANT_NOT_FOUND- L’ID de l’assistant est invalide ou n’appartient pas à votre compteINSUFFICIENT_BALANCE- Le solde de votre compte est insuffisant pour traiter le message
Cas d’usage
Réponses IA multicanal
Utilisez ce point de terminaison pour ajouter des réponses IA à n’importe quelle plateforme de messagerie :- Recevez un message depuis WhatsApp, Facebook, SMS ou un autre canal
- Appelez ce point de terminaison avec le message et l’identifiant client
- Renvoyez la réponse IA via le canal d’origine
Intégration CRM
Intégrez les réponses IA à votre CRM ou à votre système d’assistance :- Utilisez l’identifiant de contact CRM comme
customer_identifier - Transmettez les données client sous forme de variables pour personnaliser les réponses
- La conversation persiste entre les sessions tant que le même identifiant est utilisé
Interfaces de chat personnalisées
Créez votre propre interface de chat propulsée par votre assistant Famulor :- Générez un identifiant unique pour chaque session utilisateur
- Envoyez les messages via ce point de terminaison
- Affichez les réponses IA dans votre interface
Persistance de la conversation
Les conversations sont automatiquement enregistrées selon la combinaison deassistant_id et customer_identifier :
- Même identifiant : les messages sont ajoutés à la conversation existante, en conservant le contexte complet
- Nouvel identifiant : une nouvelle conversation est créée pour le client
- Fusion des variables : lorsque des variables sont fournies, elles sont fusionnées avec les variables de conversation existantes
Bonnes pratiques
- Utilisez des identifiants cohérents : conservez toujours le même format pour les identifiants client (par ex. toujours E.164 pour les numéros de téléphone)
- Transmettez un contexte pertinent : utilisez le champ
variablespour fournir des données client qui aident l’IA à personnaliser ses réponses - Gérez les limites de débit : mettez en place une logique de nouvelle tentative avec backoff exponentiel pour les requêtes limitées
- Stockez les ID de conversation : conservez le
conversation_idrenvoyé pour une référence ou un débogage ultérieurs - Surveillez les coûts : suivez l’utilisation pour maîtriser les coûts, en particulier pour les intégrations à fort volume
{
"success": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"customer_identifier": "+14155551234",
"reply": "Hi John! I'd be happy to help you schedule an appointment. What day and time work best for you?",
"function_calls": [],
"ai_disabled": false
}
{
"success": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"customer_identifier": "+14155551234",
"reply": "I've checked our calendar and we have availability tomorrow at 2 PM and Friday at 10 AM. Which works better for you?",
"function_calls": [
{
"name": "check_availability",
"arguments": {
"start_date": "2025-01-08",
"days": 7
},
"result": {
"slots": ["2025-01-08 14:00", "2025-01-10 10:00"]
}
}
],
"ai_disabled": false
}
{
"success": false,
"error": "Assistant not found or does not belong to you",
"error_code": "ASSISTANT_NOT_FOUND"
}
{
"success": false,
"error": "Insufficient balance. Please top up your account.",
"error_code": "INSUFFICIENT_BALANCE"
}
{
"message": "The assistant id field is required.",
"errors": {
"assistant_id": ["The assistant id field is required."]
}
}
{
"message": "Too Many Attempts.",
"retry_after": 60
}
Pages associées : Introduction et Guide d’authentification, et Exemples d’intégration API.