API Documentation
SDK Documentation
Voice Enablement
Transcription Routes
Text to Speech Routes
Real Time Routes
Twilio Phone Numbers Routes
Voice Agents Routes
Voice Agents Conversations Routes
AI Content Routes
Project Routes
API Statistics Routes
Voice Agents Routes
Create Voice Agent Route
Create a new voice agent to start using our powerful and robust voice assistant feature. This route requires an API key for authentication.
POST
/
v1
/
voice-agents
Create a new voice agent
Copy
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"agentName": "<string>",
"greetingMessage": "Hello, how can I help you today?",
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"pokeMessages": [],
"realTime": false,
"silenceThreshold": 800,
"interrupt": false,
"outcome": null,
"voiceId": "1f3396aa-24e3-4523-b4ef-7dd4adb8fab9",
"tools": {
"googleCalendar": false,
"genderDetection": false,
"smartCallEnd": false
},
"params": {},
"googleCalendarSettings": {
"calendarId": "<string>",
"eventTitle": "New meeting by {agentName}",
"calendarName": "<string>",
"accessToken": "<string>",
"refreshToken": "<string>",
"meetingDuration": 123,
"timezone": "Pacific/Niue",
"freeSlots": {
"Monday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Tuesday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Wednesday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Thursday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Friday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Saturday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Sunday": [
{
"from": "<string>",
"to": "<string>"
}
]
}
}
}'
Copy
{
"success": false,
"message": "success",
"data": {
"id": "<string>",
"agentName": "<string>",
"greetingMessage": "<string>",
"description": "<string>",
"preamble": "<string>",
"lang": "<string>",
"pokeMessages": [
"<string>"
],
"realTime": true,
"silenceThreshold": 123,
"interrupt": true,
"outcome": "<string>",
"projectId": "<string>",
"apiKeyId": "<string>",
"voiceRecordId": "<string>",
"voiceRecord": {},
"tools": {
"id": "<string>",
"calendarName": "<string>",
"accessToken": "<string>",
"refreshToken": "<string>",
"freeSlots": {
"Monday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Tuesday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Wednesday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Thursday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Friday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Saturday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Sunday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
]
},
"meetingDuration": 123,
"timezone": "<string>",
"voiceAgentToolsId": "<string>",
"calendarId": "<string>",
"eventTitle": "<string>"
},
"params": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token <api-key>'
Body
application/json
Response
200
application/json
Successful response
The response is of type object
.
Create a new voice agent
Copy
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"agentName": "<string>",
"greetingMessage": "Hello, how can I help you today?",
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"pokeMessages": [],
"realTime": false,
"silenceThreshold": 800,
"interrupt": false,
"outcome": null,
"voiceId": "1f3396aa-24e3-4523-b4ef-7dd4adb8fab9",
"tools": {
"googleCalendar": false,
"genderDetection": false,
"smartCallEnd": false
},
"params": {},
"googleCalendarSettings": {
"calendarId": "<string>",
"eventTitle": "New meeting by {agentName}",
"calendarName": "<string>",
"accessToken": "<string>",
"refreshToken": "<string>",
"meetingDuration": 123,
"timezone": "Pacific/Niue",
"freeSlots": {
"Monday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Tuesday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Wednesday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Thursday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Friday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Saturday": [
{
"from": "<string>",
"to": "<string>"
}
],
"Sunday": [
{
"from": "<string>",
"to": "<string>"
}
]
}
}
}'
Copy
{
"success": false,
"message": "success",
"data": {
"id": "<string>",
"agentName": "<string>",
"greetingMessage": "<string>",
"description": "<string>",
"preamble": "<string>",
"lang": "<string>",
"pokeMessages": [
"<string>"
],
"realTime": true,
"silenceThreshold": 123,
"interrupt": true,
"outcome": "<string>",
"projectId": "<string>",
"apiKeyId": "<string>",
"voiceRecordId": "<string>",
"voiceRecord": {},
"tools": {
"id": "<string>",
"calendarName": "<string>",
"accessToken": "<string>",
"refreshToken": "<string>",
"freeSlots": {
"Monday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Tuesday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Wednesday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Thursday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Friday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Saturday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
],
"Sunday": [
[
{
"from": "<string>",
"to": "<string>"
}
]
]
},
"meetingDuration": 123,
"timezone": "<string>",
"voiceAgentToolsId": "<string>",
"calendarId": "<string>",
"eventTitle": "<string>"
},
"params": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
Assistant
Responses are generated using AI and may contain mistakes.