API
Accedi
Documentazione › Account e AI › Interroga l'assistente AI
POST

Interroga l'assistente AI

POSThttps://app.sendapp.ai/api/conversation/ask
Invia una domanda all'assistente AI usando il token dell'account. Passa un conversation_id per mantenere il contesto tra più richieste.
Parametri
apikey obbligatorio
La tua API Key.
token obbligatorio
Token per questa conversazione.
question obbligatorio
La tua domanda.
conversation_id opzionale
Identificatore di conversazione per il contesto.
Richiesta
curl -X POST 'https://app.sendapp.ai/api/conversation/ask' \
  -H 'Content-Type: application/json' \
  -d '{
    "apikey": "YOUR_API_KEY",
    "token": "YOUR_ACCOUNT_TOKEN",
    "question": "Ciao, come puoi aiutarmi?"
  }'
<?php
$ch = curl_init('https://app.sendapp.ai/api/conversation/ask');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode([
        'apikey'   => 'YOUR_API_KEY',
        'token'    => 'YOUR_ACCOUNT_TOKEN',
        'question' => 'Ciao, come puoi aiutarmi?',
    ]),
]);
echo curl_exec($ch);
curl_close($ch);
const res = await fetch('https://app.sendapp.ai/api/conversation/ask', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    apikey: 'YOUR_API_KEY',
    token: 'YOUR_ACCOUNT_TOKEN',
    question: 'Ciao, come puoi aiutarmi?'
  })
});
console.log(await res.json());
Risposta (200 OK)
{
  "status": "success",
  "conversation_id": "9f8e7d6c-5b4a-3c2d-1e0f-abcdef123456",
  "response": "Certo! Il nostro orario di apertura è dal lunedì al venerdì, dalle 9:00 alle 18:00.",
  "transcription": null
}
Errore
{
  "status": "error",
  "message": "This API key is not authorized for this token."
}