curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/web-tool \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "FUNCTION",
"name": "get_order_status",
"description": "Look up the status of an order by its number.",
"async": false,
"toolSettings": {
"serverUrl": "https://api.example.com/orders/status",
"methodType": "POST",
"timeOut": 10,
"authToken": "{{secrets.ORDERS_API_TOKEN}}"
},
"messages": [
{
"type": "REQUEST_START",
"content": "Let me check that for you."
}
],
"params": {
"type": "object",
"properties": {
"order_number": {
"type": "string",
"description": "The order number the caller gives."
}
},
"required": [
"order_number"
]
}
}
'{
"success": false,
"message": "success",
"data": {
"id": "009a3a7c-beb4-4471-9175-b49144daf4ad",
"name": "Tool",
"type": "FUNCTION",
"userId": "095e678e-2b18-4138-aae9-f4d92b557104",
"projectId": "ec4215b3-c65d-494d-b268-5618647207d8",
"async": true,
"strict": true,
"description": "dasdsad",
"toolSettings": {
"serverUrl": "http://google.com",
"timeout": 100000,
"authToken": "dasdsad",
"methodType": "POST",
"httpHeaders": {
"X-Account-Id": "12345"
},
"pathParameters": {
"orderId": "48213"
},
"onHoldMusic": false,
"hasAuthToken": true,
"httpHeaderNames": [
"X-Account-Id"
]
},
"params": {
"location": {
"type": "string",
"description": "The location to get weather for"
}
},
"messages": [
{
"type": "system",
"content": "You are a helpful weather assistant."
}
],
"persistentId": "cmjx8qzw0000004kz3jek1ktu",
"version": 1,
"isActive": true,
"collectionId": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Web Tools Routes
Create a new web tool.
deprecated
POST
/
v1
/
voice-agents
/
web-tool
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/web-tool \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "FUNCTION",
"name": "get_order_status",
"description": "Look up the status of an order by its number.",
"async": false,
"toolSettings": {
"serverUrl": "https://api.example.com/orders/status",
"methodType": "POST",
"timeOut": 10,
"authToken": "{{secrets.ORDERS_API_TOKEN}}"
},
"messages": [
{
"type": "REQUEST_START",
"content": "Let me check that for you."
}
],
"params": {
"type": "object",
"properties": {
"order_number": {
"type": "string",
"description": "The order number the caller gives."
}
},
"required": [
"order_number"
]
}
}
'{
"success": false,
"message": "success",
"data": {
"id": "009a3a7c-beb4-4471-9175-b49144daf4ad",
"name": "Tool",
"type": "FUNCTION",
"userId": "095e678e-2b18-4138-aae9-f4d92b557104",
"projectId": "ec4215b3-c65d-494d-b268-5618647207d8",
"async": true,
"strict": true,
"description": "dasdsad",
"toolSettings": {
"serverUrl": "http://google.com",
"timeout": 100000,
"authToken": "dasdsad",
"methodType": "POST",
"httpHeaders": {
"X-Account-Id": "12345"
},
"pathParameters": {
"orderId": "48213"
},
"onHoldMusic": false,
"hasAuthToken": true,
"httpHeaderNames": [
"X-Account-Id"
]
},
"params": {
"location": {
"type": "string",
"description": "The location to get weather for"
}
},
"messages": [
{
"type": "system",
"content": "You are a helpful weather assistant."
}
],
"persistentId": "cmjx8qzw0000004kz3jek1ktu",
"version": 1,
"isActive": true,
"collectionId": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Body
application/json
Was this page helpful?