Yeni bir araç oluşturun
/api/v1/toolsYeni bir araç oluşturur ve konfigürasyonunu kaydeder.
namestring (gerekli)Aracın adı
typestring (gerekli)Araç tipi: API_REQUEST, DATABASE_QUERY, KNOWLEDGE_BASE, SEND_TEXT, END_CALL, TRANSFER_CALL
descriptionstring (gerekli)Aracın açıklaması
configobject (gerekli)Araç tipine özel konfigürasyon
curl -X POST https://api.wespoke.ai/api/v1/tools \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "CRM Sorgu",
"type": "API_REQUEST",
"description": "CRM API'sinden müşteri bilgisi çeker",
"config": {
"url": "https://api.crm.local/customers/{id}",
"method": "GET",
"headers": {
"Authorization": "Bearer {{secrets.CRM_API_KEY}}"
},
"query": {
"expand": "details"
}
}
}'curl -X POST https://api.wespoke.ai/api/v1/tools \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Müşteri Bilgisi",
"type": "DATABASE_QUERY",
"description": "Veritabanından müşteri bilgisi getirir",
"config": {
"query": "SELECT * FROM customers WHERE phone = :phone",
"parameters": {
"phone": "{{caller_number}}"
}
}
}'curl -X POST https://api.wespoke.ai/api/v1/tools \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Ürün Bilgisi",
"type": "KNOWLEDGE_BASE",
"description": "Bilgi tabanından ürün bilgisi arar",
"config": {
"knowledgeBaseId": "kb_xyz789",
"maxResults": 3
}
}'{
"success": true,
"data": {
"id": "tool_abc123",
"name": "CRM Sorgu",
"type": "API_REQUEST",
"description": "CRM API'sinden müşteri bilgisi çeker",
"config": {
"url": "https://api.crm.local/customers/{id}",
"method": "GET",
"headers": {
"Authorization": "Bearer {{secrets.CRM_API_KEY}}"
},
"query": {
"expand": "details"
}
},
"createdAt": "2024-01-14T09:00:00Z",
"updatedAt": "2024-01-14T09:00:00Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Geçersiz araç konfigürasyonu",
"details": {
"name": "Araç adı gereklidir",
"type": "Geçersiz araç tipi"
}
}
}