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?",
"greetingMessageType": null,
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"pokeMessages": [],
"realTime": false,
"silenceThreshold": 800,
"interrupt": true,
"type": "Single Prompt",
"outcome": null,
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"voiceId": null,
"tools": {
"genderDetection": false,
"smartCallEnd": false
},
"params": {},
"alignment": {
"greetingMessage": "ltr",
"preamble": "ltr"
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {},
"userInactivityTimeout": 15,
"maxCallDuration": 300,
"responseDelay": 400,
"backgroundNoise": false,
"waitForUserToSpeakFirst": 0,
"thinkingVoice": false,
"speakerIdentification": false,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "telephony-optimized",
"cancelNoisePer": "conversation",
"agenticRag": false,
"languageDialectSwitcher": false,
"minInterruptionDuration": 0.5,
"vadActivationThreshold": 0.5,
"enableAutoGainControl": false,
"sendDenoisedToStt": false
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents"
payload = {
"agentName": "<string>",
"greetingMessage": "Hello, how can I help you today?",
"greetingMessageType": None,
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"pokeMessages": [],
"realTime": False,
"silenceThreshold": 800,
"interrupt": True,
"type": "Single Prompt",
"outcome": None,
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"outcomeResponseShape": {
"type": "object",
"properties": { "test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
} },
"required": ["test"]
},
"voiceId": None,
"tools": {
"genderDetection": False,
"smartCallEnd": False
},
"params": {},
"alignment": {
"greetingMessage": "ltr",
"preamble": "ltr"
},
"webToolsIds": ["<string>"],
"voiceDictionaryIds": ["<string>"],
"knowledgeBaseItemsIds": ["<string>"],
"webToolsOverrides": {},
"userInactivityTimeout": 15,
"maxCallDuration": 300,
"responseDelay": 400,
"backgroundNoise": False,
"waitForUserToSpeakFirst": 0,
"thinkingVoice": False,
"speakerIdentification": False,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "telephony-optimized",
"cancelNoisePer": "conversation",
"agenticRag": False,
"languageDialectSwitcher": False,
"minInterruptionDuration": 0.5,
"vadActivationThreshold": 0.5,
"enableAutoGainControl": False,
"sendDenoisedToStt": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentName: '<string>',
greetingMessage: 'Hello, how can I help you today?',
greetingMessageType: null,
preamble: 'You are a helpful assistant that will answer users questions.',
lang: 'ar',
pokeMessages: [],
realTime: false,
silenceThreshold: 800,
interrupt: true,
type: 'Single Prompt',
outcome: null,
webhookUrl: 'https://example.com/webhook',
webhookAuth: {authKey: 'Token', authSecret: 'Secret'},
outcomeResponseShape: {
type: 'object',
properties: {test: {type: 'number', description: 'Hello world from Hamsa AI!'}},
required: ['test']
},
voiceId: null,
tools: {genderDetection: false, smartCallEnd: false},
params: {},
alignment: {greetingMessage: 'ltr', preamble: 'ltr'},
webToolsIds: ['<string>'],
voiceDictionaryIds: ['<string>'],
knowledgeBaseItemsIds: ['<string>'],
webToolsOverrides: {},
userInactivityTimeout: 15,
maxCallDuration: 300,
responseDelay: 400,
backgroundNoise: false,
waitForUserToSpeakFirst: 0,
thinkingVoice: false,
speakerIdentification: false,
llmConfig: {
provider: 'OpenAI',
modelName: 'GPT-4.1',
baseUrl: 'https://api.custom-llm.com/v1',
apiKey: 'sk-...',
temperature: 0.2
},
noiseCancellation: 'telephony-optimized',
cancelNoisePer: 'conversation',
agenticRag: false,
languageDialectSwitcher: false,
minInterruptionDuration: 0.5,
vadActivationThreshold: 0.5,
enableAutoGainControl: false,
sendDenoisedToStt: false
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v1/voice-agents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agentName' => '<string>',
'greetingMessage' => 'Hello, how can I help you today?',
'greetingMessageType' => null,
'preamble' => 'You are a helpful assistant that will answer users questions.',
'lang' => 'ar',
'pokeMessages' => [
],
'realTime' => false,
'silenceThreshold' => 800,
'interrupt' => true,
'type' => 'Single Prompt',
'outcome' => null,
'webhookUrl' => 'https://example.com/webhook',
'webhookAuth' => [
'authKey' => 'Token',
'authSecret' => 'Secret'
],
'outcomeResponseShape' => [
'type' => 'object',
'properties' => [
'test' => [
'type' => 'number',
'description' => 'Hello world from Hamsa AI!'
]
],
'required' => [
'test'
]
],
'voiceId' => null,
'tools' => [
'genderDetection' => false,
'smartCallEnd' => false
],
'params' => [
],
'alignment' => [
'greetingMessage' => 'ltr',
'preamble' => 'ltr'
],
'webToolsIds' => [
'<string>'
],
'voiceDictionaryIds' => [
'<string>'
],
'knowledgeBaseItemsIds' => [
'<string>'
],
'webToolsOverrides' => [
],
'userInactivityTimeout' => 15,
'maxCallDuration' => 300,
'responseDelay' => 400,
'backgroundNoise' => false,
'waitForUserToSpeakFirst' => 0,
'thinkingVoice' => false,
'speakerIdentification' => false,
'llmConfig' => [
'provider' => 'OpenAI',
'modelName' => 'GPT-4.1',
'baseUrl' => 'https://api.custom-llm.com/v1',
'apiKey' => 'sk-...',
'temperature' => 0.2
],
'noiseCancellation' => 'telephony-optimized',
'cancelNoisePer' => 'conversation',
'agenticRag' => false,
'languageDialectSwitcher' => false,
'minInterruptionDuration' => 0.5,
'vadActivationThreshold' => 0.5,
'enableAutoGainControl' => false,
'sendDenoisedToStt' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents"
payload := strings.NewReader("{\n \"agentName\": \"<string>\",\n \"greetingMessage\": \"Hello, how can I help you today?\",\n \"greetingMessageType\": null,\n \"preamble\": \"You are a helpful assistant that will answer users questions.\",\n \"lang\": \"ar\",\n \"pokeMessages\": [],\n \"realTime\": false,\n \"silenceThreshold\": 800,\n \"interrupt\": true,\n \"type\": \"Single Prompt\",\n \"outcome\": null,\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n },\n \"outcomeResponseShape\": {\n \"type\": \"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"number\",\n \"description\": \"Hello world from Hamsa AI!\"\n }\n },\n \"required\": [\n \"test\"\n ]\n },\n \"voiceId\": null,\n \"tools\": {\n \"genderDetection\": false,\n \"smartCallEnd\": false\n },\n \"params\": {},\n \"alignment\": {\n \"greetingMessage\": \"ltr\",\n \"preamble\": \"ltr\"\n },\n \"webToolsIds\": [\n \"<string>\"\n ],\n \"voiceDictionaryIds\": [\n \"<string>\"\n ],\n \"knowledgeBaseItemsIds\": [\n \"<string>\"\n ],\n \"webToolsOverrides\": {},\n \"userInactivityTimeout\": 15,\n \"maxCallDuration\": 300,\n \"responseDelay\": 400,\n \"backgroundNoise\": false,\n \"waitForUserToSpeakFirst\": 0,\n \"thinkingVoice\": false,\n \"speakerIdentification\": false,\n \"llmConfig\": {\n \"provider\": \"OpenAI\",\n \"modelName\": \"GPT-4.1\",\n \"baseUrl\": \"https://api.custom-llm.com/v1\",\n \"apiKey\": \"sk-...\",\n \"temperature\": 0.2\n },\n \"noiseCancellation\": \"telephony-optimized\",\n \"cancelNoisePer\": \"conversation\",\n \"agenticRag\": false,\n \"languageDialectSwitcher\": false,\n \"minInterruptionDuration\": 0.5,\n \"vadActivationThreshold\": 0.5,\n \"enableAutoGainControl\": false,\n \"sendDenoisedToStt\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v1/voice-agents")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentName\": \"<string>\",\n \"greetingMessage\": \"Hello, how can I help you today?\",\n \"greetingMessageType\": null,\n \"preamble\": \"You are a helpful assistant that will answer users questions.\",\n \"lang\": \"ar\",\n \"pokeMessages\": [],\n \"realTime\": false,\n \"silenceThreshold\": 800,\n \"interrupt\": true,\n \"type\": \"Single Prompt\",\n \"outcome\": null,\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n },\n \"outcomeResponseShape\": {\n \"type\": \"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"number\",\n \"description\": \"Hello world from Hamsa AI!\"\n }\n },\n \"required\": [\n \"test\"\n ]\n },\n \"voiceId\": null,\n \"tools\": {\n \"genderDetection\": false,\n \"smartCallEnd\": false\n },\n \"params\": {},\n \"alignment\": {\n \"greetingMessage\": \"ltr\",\n \"preamble\": \"ltr\"\n },\n \"webToolsIds\": [\n \"<string>\"\n ],\n \"voiceDictionaryIds\": [\n \"<string>\"\n ],\n \"knowledgeBaseItemsIds\": [\n \"<string>\"\n ],\n \"webToolsOverrides\": {},\n \"userInactivityTimeout\": 15,\n \"maxCallDuration\": 300,\n \"responseDelay\": 400,\n \"backgroundNoise\": false,\n \"waitForUserToSpeakFirst\": 0,\n \"thinkingVoice\": false,\n \"speakerIdentification\": false,\n \"llmConfig\": {\n \"provider\": \"OpenAI\",\n \"modelName\": \"GPT-4.1\",\n \"baseUrl\": \"https://api.custom-llm.com/v1\",\n \"apiKey\": \"sk-...\",\n \"temperature\": 0.2\n },\n \"noiseCancellation\": \"telephony-optimized\",\n \"cancelNoisePer\": \"conversation\",\n \"agenticRag\": false,\n \"languageDialectSwitcher\": false,\n \"minInterruptionDuration\": 0.5,\n \"vadActivationThreshold\": 0.5,\n \"enableAutoGainControl\": false,\n \"sendDenoisedToStt\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentName\": \"<string>\",\n \"greetingMessage\": \"Hello, how can I help you today?\",\n \"greetingMessageType\": null,\n \"preamble\": \"You are a helpful assistant that will answer users questions.\",\n \"lang\": \"ar\",\n \"pokeMessages\": [],\n \"realTime\": false,\n \"silenceThreshold\": 800,\n \"interrupt\": true,\n \"type\": \"Single Prompt\",\n \"outcome\": null,\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n },\n \"outcomeResponseShape\": {\n \"type\": \"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"number\",\n \"description\": \"Hello world from Hamsa AI!\"\n }\n },\n \"required\": [\n \"test\"\n ]\n },\n \"voiceId\": null,\n \"tools\": {\n \"genderDetection\": false,\n \"smartCallEnd\": false\n },\n \"params\": {},\n \"alignment\": {\n \"greetingMessage\": \"ltr\",\n \"preamble\": \"ltr\"\n },\n \"webToolsIds\": [\n \"<string>\"\n ],\n \"voiceDictionaryIds\": [\n \"<string>\"\n ],\n \"knowledgeBaseItemsIds\": [\n \"<string>\"\n ],\n \"webToolsOverrides\": {},\n \"userInactivityTimeout\": 15,\n \"maxCallDuration\": 300,\n \"responseDelay\": 400,\n \"backgroundNoise\": false,\n \"waitForUserToSpeakFirst\": 0,\n \"thinkingVoice\": false,\n \"speakerIdentification\": false,\n \"llmConfig\": {\n \"provider\": \"OpenAI\",\n \"modelName\": \"GPT-4.1\",\n \"baseUrl\": \"https://api.custom-llm.com/v1\",\n \"apiKey\": \"sk-...\",\n \"temperature\": 0.2\n },\n \"noiseCancellation\": \"telephony-optimized\",\n \"cancelNoisePer\": \"conversation\",\n \"agenticRag\": false,\n \"languageDialectSwitcher\": false,\n \"minInterruptionDuration\": 0.5,\n \"vadActivationThreshold\": 0.5,\n \"enableAutoGainControl\": false,\n \"sendDenoisedToStt\": false\n}"
response = http.request(request)
puts response.read_body{
"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,
"type": "<string>",
"outcome": "<string>",
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"projectId": "<string>",
"apiKeyId": "<string>",
"voiceId": "<string>",
"voiceRecordId": "<string>",
"voiceRecord": {},
"collectionId": "<string>",
"isTemplate": true,
"icon": "<string>",
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"params": {},
"alignment": {
"greetingMessage": "<string>",
"preamble": "<string>"
},
"tools": {
"genderDetection": true,
"smartCallEnd": true
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {},
"userInactivityTimeout": 123,
"maxCallDuration": 123,
"responseDelay": 123,
"backgroundNoise": true,
"waitForUserToSpeakFirst": 123,
"thinkingVoice": true,
"speakerIdentification": true,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "<string>",
"cancelNoisePer": "<string>",
"agenticRag": true,
"languageDialectSwitcher": true,
"minInterruptionDuration": 123,
"vadActivationThreshold": 123,
"enableAutoGainControl": true,
"sendDenoisedToStt": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}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.
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?",
"greetingMessageType": null,
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"pokeMessages": [],
"realTime": false,
"silenceThreshold": 800,
"interrupt": true,
"type": "Single Prompt",
"outcome": null,
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"voiceId": null,
"tools": {
"genderDetection": false,
"smartCallEnd": false
},
"params": {},
"alignment": {
"greetingMessage": "ltr",
"preamble": "ltr"
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {},
"userInactivityTimeout": 15,
"maxCallDuration": 300,
"responseDelay": 400,
"backgroundNoise": false,
"waitForUserToSpeakFirst": 0,
"thinkingVoice": false,
"speakerIdentification": false,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "telephony-optimized",
"cancelNoisePer": "conversation",
"agenticRag": false,
"languageDialectSwitcher": false,
"minInterruptionDuration": 0.5,
"vadActivationThreshold": 0.5,
"enableAutoGainControl": false,
"sendDenoisedToStt": false
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents"
payload = {
"agentName": "<string>",
"greetingMessage": "Hello, how can I help you today?",
"greetingMessageType": None,
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"pokeMessages": [],
"realTime": False,
"silenceThreshold": 800,
"interrupt": True,
"type": "Single Prompt",
"outcome": None,
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"outcomeResponseShape": {
"type": "object",
"properties": { "test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
} },
"required": ["test"]
},
"voiceId": None,
"tools": {
"genderDetection": False,
"smartCallEnd": False
},
"params": {},
"alignment": {
"greetingMessage": "ltr",
"preamble": "ltr"
},
"webToolsIds": ["<string>"],
"voiceDictionaryIds": ["<string>"],
"knowledgeBaseItemsIds": ["<string>"],
"webToolsOverrides": {},
"userInactivityTimeout": 15,
"maxCallDuration": 300,
"responseDelay": 400,
"backgroundNoise": False,
"waitForUserToSpeakFirst": 0,
"thinkingVoice": False,
"speakerIdentification": False,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "telephony-optimized",
"cancelNoisePer": "conversation",
"agenticRag": False,
"languageDialectSwitcher": False,
"minInterruptionDuration": 0.5,
"vadActivationThreshold": 0.5,
"enableAutoGainControl": False,
"sendDenoisedToStt": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentName: '<string>',
greetingMessage: 'Hello, how can I help you today?',
greetingMessageType: null,
preamble: 'You are a helpful assistant that will answer users questions.',
lang: 'ar',
pokeMessages: [],
realTime: false,
silenceThreshold: 800,
interrupt: true,
type: 'Single Prompt',
outcome: null,
webhookUrl: 'https://example.com/webhook',
webhookAuth: {authKey: 'Token', authSecret: 'Secret'},
outcomeResponseShape: {
type: 'object',
properties: {test: {type: 'number', description: 'Hello world from Hamsa AI!'}},
required: ['test']
},
voiceId: null,
tools: {genderDetection: false, smartCallEnd: false},
params: {},
alignment: {greetingMessage: 'ltr', preamble: 'ltr'},
webToolsIds: ['<string>'],
voiceDictionaryIds: ['<string>'],
knowledgeBaseItemsIds: ['<string>'],
webToolsOverrides: {},
userInactivityTimeout: 15,
maxCallDuration: 300,
responseDelay: 400,
backgroundNoise: false,
waitForUserToSpeakFirst: 0,
thinkingVoice: false,
speakerIdentification: false,
llmConfig: {
provider: 'OpenAI',
modelName: 'GPT-4.1',
baseUrl: 'https://api.custom-llm.com/v1',
apiKey: 'sk-...',
temperature: 0.2
},
noiseCancellation: 'telephony-optimized',
cancelNoisePer: 'conversation',
agenticRag: false,
languageDialectSwitcher: false,
minInterruptionDuration: 0.5,
vadActivationThreshold: 0.5,
enableAutoGainControl: false,
sendDenoisedToStt: false
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v1/voice-agents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agentName' => '<string>',
'greetingMessage' => 'Hello, how can I help you today?',
'greetingMessageType' => null,
'preamble' => 'You are a helpful assistant that will answer users questions.',
'lang' => 'ar',
'pokeMessages' => [
],
'realTime' => false,
'silenceThreshold' => 800,
'interrupt' => true,
'type' => 'Single Prompt',
'outcome' => null,
'webhookUrl' => 'https://example.com/webhook',
'webhookAuth' => [
'authKey' => 'Token',
'authSecret' => 'Secret'
],
'outcomeResponseShape' => [
'type' => 'object',
'properties' => [
'test' => [
'type' => 'number',
'description' => 'Hello world from Hamsa AI!'
]
],
'required' => [
'test'
]
],
'voiceId' => null,
'tools' => [
'genderDetection' => false,
'smartCallEnd' => false
],
'params' => [
],
'alignment' => [
'greetingMessage' => 'ltr',
'preamble' => 'ltr'
],
'webToolsIds' => [
'<string>'
],
'voiceDictionaryIds' => [
'<string>'
],
'knowledgeBaseItemsIds' => [
'<string>'
],
'webToolsOverrides' => [
],
'userInactivityTimeout' => 15,
'maxCallDuration' => 300,
'responseDelay' => 400,
'backgroundNoise' => false,
'waitForUserToSpeakFirst' => 0,
'thinkingVoice' => false,
'speakerIdentification' => false,
'llmConfig' => [
'provider' => 'OpenAI',
'modelName' => 'GPT-4.1',
'baseUrl' => 'https://api.custom-llm.com/v1',
'apiKey' => 'sk-...',
'temperature' => 0.2
],
'noiseCancellation' => 'telephony-optimized',
'cancelNoisePer' => 'conversation',
'agenticRag' => false,
'languageDialectSwitcher' => false,
'minInterruptionDuration' => 0.5,
'vadActivationThreshold' => 0.5,
'enableAutoGainControl' => false,
'sendDenoisedToStt' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents"
payload := strings.NewReader("{\n \"agentName\": \"<string>\",\n \"greetingMessage\": \"Hello, how can I help you today?\",\n \"greetingMessageType\": null,\n \"preamble\": \"You are a helpful assistant that will answer users questions.\",\n \"lang\": \"ar\",\n \"pokeMessages\": [],\n \"realTime\": false,\n \"silenceThreshold\": 800,\n \"interrupt\": true,\n \"type\": \"Single Prompt\",\n \"outcome\": null,\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n },\n \"outcomeResponseShape\": {\n \"type\": \"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"number\",\n \"description\": \"Hello world from Hamsa AI!\"\n }\n },\n \"required\": [\n \"test\"\n ]\n },\n \"voiceId\": null,\n \"tools\": {\n \"genderDetection\": false,\n \"smartCallEnd\": false\n },\n \"params\": {},\n \"alignment\": {\n \"greetingMessage\": \"ltr\",\n \"preamble\": \"ltr\"\n },\n \"webToolsIds\": [\n \"<string>\"\n ],\n \"voiceDictionaryIds\": [\n \"<string>\"\n ],\n \"knowledgeBaseItemsIds\": [\n \"<string>\"\n ],\n \"webToolsOverrides\": {},\n \"userInactivityTimeout\": 15,\n \"maxCallDuration\": 300,\n \"responseDelay\": 400,\n \"backgroundNoise\": false,\n \"waitForUserToSpeakFirst\": 0,\n \"thinkingVoice\": false,\n \"speakerIdentification\": false,\n \"llmConfig\": {\n \"provider\": \"OpenAI\",\n \"modelName\": \"GPT-4.1\",\n \"baseUrl\": \"https://api.custom-llm.com/v1\",\n \"apiKey\": \"sk-...\",\n \"temperature\": 0.2\n },\n \"noiseCancellation\": \"telephony-optimized\",\n \"cancelNoisePer\": \"conversation\",\n \"agenticRag\": false,\n \"languageDialectSwitcher\": false,\n \"minInterruptionDuration\": 0.5,\n \"vadActivationThreshold\": 0.5,\n \"enableAutoGainControl\": false,\n \"sendDenoisedToStt\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v1/voice-agents")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentName\": \"<string>\",\n \"greetingMessage\": \"Hello, how can I help you today?\",\n \"greetingMessageType\": null,\n \"preamble\": \"You are a helpful assistant that will answer users questions.\",\n \"lang\": \"ar\",\n \"pokeMessages\": [],\n \"realTime\": false,\n \"silenceThreshold\": 800,\n \"interrupt\": true,\n \"type\": \"Single Prompt\",\n \"outcome\": null,\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n },\n \"outcomeResponseShape\": {\n \"type\": \"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"number\",\n \"description\": \"Hello world from Hamsa AI!\"\n }\n },\n \"required\": [\n \"test\"\n ]\n },\n \"voiceId\": null,\n \"tools\": {\n \"genderDetection\": false,\n \"smartCallEnd\": false\n },\n \"params\": {},\n \"alignment\": {\n \"greetingMessage\": \"ltr\",\n \"preamble\": \"ltr\"\n },\n \"webToolsIds\": [\n \"<string>\"\n ],\n \"voiceDictionaryIds\": [\n \"<string>\"\n ],\n \"knowledgeBaseItemsIds\": [\n \"<string>\"\n ],\n \"webToolsOverrides\": {},\n \"userInactivityTimeout\": 15,\n \"maxCallDuration\": 300,\n \"responseDelay\": 400,\n \"backgroundNoise\": false,\n \"waitForUserToSpeakFirst\": 0,\n \"thinkingVoice\": false,\n \"speakerIdentification\": false,\n \"llmConfig\": {\n \"provider\": \"OpenAI\",\n \"modelName\": \"GPT-4.1\",\n \"baseUrl\": \"https://api.custom-llm.com/v1\",\n \"apiKey\": \"sk-...\",\n \"temperature\": 0.2\n },\n \"noiseCancellation\": \"telephony-optimized\",\n \"cancelNoisePer\": \"conversation\",\n \"agenticRag\": false,\n \"languageDialectSwitcher\": false,\n \"minInterruptionDuration\": 0.5,\n \"vadActivationThreshold\": 0.5,\n \"enableAutoGainControl\": false,\n \"sendDenoisedToStt\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentName\": \"<string>\",\n \"greetingMessage\": \"Hello, how can I help you today?\",\n \"greetingMessageType\": null,\n \"preamble\": \"You are a helpful assistant that will answer users questions.\",\n \"lang\": \"ar\",\n \"pokeMessages\": [],\n \"realTime\": false,\n \"silenceThreshold\": 800,\n \"interrupt\": true,\n \"type\": \"Single Prompt\",\n \"outcome\": null,\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n },\n \"outcomeResponseShape\": {\n \"type\": \"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"number\",\n \"description\": \"Hello world from Hamsa AI!\"\n }\n },\n \"required\": [\n \"test\"\n ]\n },\n \"voiceId\": null,\n \"tools\": {\n \"genderDetection\": false,\n \"smartCallEnd\": false\n },\n \"params\": {},\n \"alignment\": {\n \"greetingMessage\": \"ltr\",\n \"preamble\": \"ltr\"\n },\n \"webToolsIds\": [\n \"<string>\"\n ],\n \"voiceDictionaryIds\": [\n \"<string>\"\n ],\n \"knowledgeBaseItemsIds\": [\n \"<string>\"\n ],\n \"webToolsOverrides\": {},\n \"userInactivityTimeout\": 15,\n \"maxCallDuration\": 300,\n \"responseDelay\": 400,\n \"backgroundNoise\": false,\n \"waitForUserToSpeakFirst\": 0,\n \"thinkingVoice\": false,\n \"speakerIdentification\": false,\n \"llmConfig\": {\n \"provider\": \"OpenAI\",\n \"modelName\": \"GPT-4.1\",\n \"baseUrl\": \"https://api.custom-llm.com/v1\",\n \"apiKey\": \"sk-...\",\n \"temperature\": 0.2\n },\n \"noiseCancellation\": \"telephony-optimized\",\n \"cancelNoisePer\": \"conversation\",\n \"agenticRag\": false,\n \"languageDialectSwitcher\": false,\n \"minInterruptionDuration\": 0.5,\n \"vadActivationThreshold\": 0.5,\n \"enableAutoGainControl\": false,\n \"sendDenoisedToStt\": false\n}"
response = http.request(request)
puts response.read_body{
"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,
"type": "<string>",
"outcome": "<string>",
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"projectId": "<string>",
"apiKeyId": "<string>",
"voiceId": "<string>",
"voiceRecordId": "<string>",
"voiceRecord": {},
"collectionId": "<string>",
"isTemplate": true,
"icon": "<string>",
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"params": {},
"alignment": {
"greetingMessage": "<string>",
"preamble": "<string>"
},
"tools": {
"genderDetection": true,
"smartCallEnd": true
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {},
"userInactivityTimeout": 123,
"maxCallDuration": 123,
"responseDelay": 123,
"backgroundNoise": true,
"waitForUserToSpeakFirst": 123,
"thinkingVoice": true,
"speakerIdentification": true,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "<string>",
"cancelNoisePer": "<string>",
"agenticRag": true,
"languageDialectSwitcher": true,
"minInterruptionDuration": 123,
"vadActivationThreshold": 123,
"enableAutoGainControl": true,
"sendDenoisedToStt": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Body
Greeting Message can be customized by adding params like: {{name}}, to make the message more personal!
STATIC, PROMPT Preamble can be customized by adding params like: {{agentName}}, to make the prompt more specific and context aware!
ar, en The messages to say to the user when he doesn't respond!
The silence threshold in milliseconds. Minimum value is 1 millisecond.
x >= 1A prompt to take the conversation and transform it to anything you like, like creating an article out of the conversation!
"https://example.com/webhook"
Authorization header to be sent in this format: Authorization: [authKey] [authSecret]
Show child attributes
Show child attributes
Recursive OpenAPI-style shape with 'type', 'properties', 'required', 'items', ...etc. Please refer to the OpenAPI Outcome Response Instructions above for more information.
{
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": ["test"]
}
Show child attributes
Show child attributes
Set the params you define in the greeting message or preamble fields here, the key is the same as the param and the value is the param value. Press 'Add new property' below to set the param name then press enter, after that add the value.
Show child attributes
Show child attributes
5 <= x <= 3030 <= x <= 600100 <= x <= 15000 <= x <= 2Configuration for the LLM (Large Language Model) used by the voice agent
Show child attributes
Show child attributes
0.2 <= x <= 1.50.2 <= x <= 0.9Was this page helpful?