Process one or more leads through the complete AI-powered task assignment workflow. This endpoint validates the request and starts background processing that analyzes conversations, determines appropriate actions, and generates personalized responses. Processing typically takes 30 seconds per lead.
Endpoint: /lead/process
Method: POST
{
"lead_ids": [277, 278, 279], // Required: Lead ID(s) to process (can be single integer or list)
"superagent_service_token": "sa_token_abc123", // Required: Service token for Superagent API authentication
"superagent_environment": "staging" // Optional: Superagent environment (default: based on app environment)
}
Status 202 (Accepted - Processing in Background):
{
"success": true,
"message": "Lead processing request accepted and will be processed in background",
"request_id": "lead_process_20240110_142301",
"total_leads": 3,
"estimated_completion_seconds": 90
}
Status 400 (Bad Request - No Valid Leads):
{
"success": false,
"error": "No valid leads found with the provided IDs",
"error_code": "NO_VALID_LEADS"
}
Status 422 (Validation Error):
{
"success": false,
"error": "Request validation failed",
"error_code": "VALIDATION_ERROR",
"details": {
"lead_ids": "Invalid lead ID format"
}
}
Status 500 (Internal Server Error):
{
"success": false,
"error": "Request validation failed: Database connection failed",
"error_code": "VALIDATION_ERROR"
}
Checks if the lead processing service is healthy and ready to process requests. This endpoint provides a health check for the lead processing service infrastructure.
Endpoint: /lead/status
Method: GET
Status 200 (Healthy):
{
"status": "healthy",
"service": "lead_processing",
"message": "Lead processing service is ready"
}