API Endpoint
POST Intent Detection API
/api/v1/ai/intent
Detect user intent from natural language messages for routing, support workflows, and automation.
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
message |
string | Required | The user message or text to classify |
context |
string | Optional | Optional product context to improve classification |
Example Request
JSON Request
{
"message": "I want to cancel my subscription",
"context": "billing support"
}
cURL
curl -X POST https://rsflowhub.com/api/v1/ai/intent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "I want to cancel my subscription",
"context": "billing support"
}'
Example Response
JSON Response
{
"success": true,
"data": {
"result": {
"intent": "cancel_subscription",
"confidence": 0.97,
"suggested_action": "route_to_billing",
"alternatives": [
{ "intent": "upgrade_plan", "confidence": 0.02 },
{ "intent": "pause_account", "confidence": 0.01 }
]
}
},
"meta": {
"credits_used": 1,
"credits_remaining": 999
}
}
SDK Examples
Use the same endpoint with JavaScript, Python, or PHP.
cURL
curl -X POST 'https://rsflowhub.com/api/v1/ai/intent' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"message": "I want to cancel my subscription",
"context": "billing support"
}'
JavaScript (fetch)
const payload = {
"message": "I want to cancel my subscription",
"context": "billing support"
};
const response = await fetch('https://rsflowhub.com/api/v1/ai/intent', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
});
const data = await response.json();
console.log(data);
Python (requests)
import requests
url = "https://rsflowhub.com/api/v1/ai/intent"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"message": "I want to cancel my subscription",
"context": "billing support"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
PHP (Laravel HTTP)
use Illuminate\Support\Facades\Http;
$response = Http::withToken('YOUR_API_KEY')
->acceptJson()
->post('https://rsflowhub.com/api/v1/ai/intent', array (
'message' => 'I want to cancel my subscription',
'context' => 'billing support',
));
$data = $response->json();
print_r($data);
Use intent labels in your app logic
Route actions by
Route actions by
result.intent and use confidence thresholds for fallback handling.