curl -X POST "https://app.supported.tech/api/user/ai/generate-reply" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "assistant_id": 123, "customer_identifier": "+14155551234", "message": "Hi, I would like to schedule an appointment", "variables": { "customer_name": "John Smith", "source": "whatsapp" } }'
const response = await fetch('https://app.supported.tech/api/user/ai/generate-reply', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ assistant_id: 123, customer_identifier: '+14155551234', message: 'Hi, I would like to schedule an appointment', variables: { customer_name: 'John Smith', source: 'whatsapp' } })});const data = await response.json();console.log(data.reply);
import requestsresponse = requests.post( 'https://app.supported.tech/api/user/ai/generate-reply', headers={ 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, json={ 'assistant_id': 123, 'customer_identifier': '+14155551234', 'message': 'Hi, I would like to schedule an appointment', 'variables': { 'customer_name': 'John Smith', 'source': 'whatsapp' } })data = response.json()print(data['reply'])
$response = Http::withToken('YOUR_API_TOKEN') ->post('https://app.supported.tech/api/user/ai/generate-reply', [ 'assistant_id' => 123, 'customer_identifier' => '+14155551234', 'message' => 'Hi, I would like to schedule an appointment', 'variables' => [ 'customer_name' => 'John Smith', 'source' => 'whatsapp' ] ]);$reply = $response->json()['reply'];
{ "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}
AI
Generate AI Reply
Generate an AI response using an assistant, identified by an external customer identifier
POST
/
user
/
ai
/
generate-reply
curl -X POST "https://app.supported.tech/api/user/ai/generate-reply" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "assistant_id": 123, "customer_identifier": "+14155551234", "message": "Hi, I would like to schedule an appointment", "variables": { "customer_name": "John Smith", "source": "whatsapp" } }'
const response = await fetch('https://app.supported.tech/api/user/ai/generate-reply', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ assistant_id: 123, customer_identifier: '+14155551234', message: 'Hi, I would like to schedule an appointment', variables: { customer_name: 'John Smith', source: 'whatsapp' } })});const data = await response.json();console.log(data.reply);
import requestsresponse = requests.post( 'https://app.supported.tech/api/user/ai/generate-reply', headers={ 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, json={ 'assistant_id': 123, 'customer_identifier': '+14155551234', 'message': 'Hi, I would like to schedule an appointment', 'variables': { 'customer_name': 'John Smith', 'source': 'whatsapp' } })data = response.json()print(data['reply'])
$response = Http::withToken('YOUR_API_TOKEN') ->post('https://app.supported.tech/api/user/ai/generate-reply', [ 'assistant_id' => 123, 'customer_identifier' => '+14155551234', 'message' => 'Hi, I would like to schedule an appointment', 'variables' => [ 'customer_name' => 'John Smith', 'source' => 'whatsapp' ] ]);$reply = $response->json()['reply'];
{ "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}
This endpoint generates an AI response for a given message using your configured assistant. It automatically creates or reuses conversations based on the customer identifier, making it ideal for integrating AI responses into external platforms, CRMs, or custom chat interfaces.
Rate Limited — This endpoint is rate limited to 5 requests per minute per API token to prevent abuse.
A unique identifier for the customer. This is used to maintain conversation context across multiple messages.Examples: phone number, email address, CRM contact ID, Facebook user ID.Maximum length: 255 characters.
Optional context variables to pass to the assistant. These are merged with any existing conversation variables.Useful for passing customer data, session context, or other metadata.
ASSISTANT_NOT_FOUND - The assistant ID is invalid or doesn’t belong to your account
INSUFFICIENT_BALANCE - Your account balance is too low to process the message
curl -X POST "https://app.supported.tech/api/user/ai/generate-reply" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "assistant_id": 123, "customer_identifier": "+14155551234", "message": "Hi, I would like to schedule an appointment", "variables": { "customer_name": "John Smith", "source": "whatsapp" } }'
const response = await fetch('https://app.supported.tech/api/user/ai/generate-reply', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ assistant_id: 123, customer_identifier: '+14155551234', message: 'Hi, I would like to schedule an appointment', variables: { customer_name: 'John Smith', source: 'whatsapp' } })});const data = await response.json();console.log(data.reply);
import requestsresponse = requests.post( 'https://app.supported.tech/api/user/ai/generate-reply', headers={ 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, json={ 'assistant_id': 123, 'customer_identifier': '+14155551234', 'message': 'Hi, I would like to schedule an appointment', 'variables': { 'customer_name': 'John Smith', 'source': 'whatsapp' } })data = response.json()print(data['reply'])
$response = Http::withToken('YOUR_API_TOKEN') ->post('https://app.supported.tech/api/user/ai/generate-reply', [ 'assistant_id' => 123, 'customer_identifier' => '+14155551234', 'message' => 'Hi, I would like to schedule an appointment', 'variables' => [ 'customer_name' => 'John Smith', 'source' => 'whatsapp' ] ]);$reply = $response->json()['reply'];
{ "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}