curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/phone-number/call \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phoneNumber": "+14155550100",
"toNumber": "+966501234567",
"voiceAgentId": "d949f13f-40d2-4e48-ac86-b66633070603",
"params": {
"customer_name": "Sara"
}
}
'{
"success": false,
"message": "success",
"data": {
"jobId": "ddb431f9-99b6-454a-a3c0-b8d0680b08b8",
"voiceAgentId": "0c2b4f0e-5a43-4e7e-9a55-6d0f1f7c2a11"
}
}{
"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"
}
}Create an Outbound Call
Places an outbound call from one of your phone numbers. When your concurrency limit (calls at once, shared by every project you own) is reached, the call waits and is tried again every 30 seconds. If no slot frees up within 60 minutes, the call is not placed: its status becomes FAILED, and callAnalysis.error says why (statusCode 429, message “Concurrency limit reached: no concurrency slot became free within 60 minutes, so the call was not placed.”).
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/phone-number/call \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phoneNumber": "+14155550100",
"toNumber": "+966501234567",
"voiceAgentId": "d949f13f-40d2-4e48-ac86-b66633070603",
"params": {
"customer_name": "Sara"
}
}
'{
"success": false,
"message": "success",
"data": {
"jobId": "ddb431f9-99b6-454a-a3c0-b8d0680b08b8",
"voiceAgentId": "0c2b4f0e-5a43-4e7e-9a55-6d0f1f7c2a11"
}
}{
"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
Values for the agent's variables on this call, as {"name": "value"}. Use with voiceAgentId; with agentDetails it must be empty (ParamsRequiredWithAgentDetails). Names are written as {{name}}, so each must be letters, digits and _, not starting with a digit, and not true, false, none, and, or, not, in, is, if or else (true, false and none in any case). Other names are refused with a JinjaName… error that suggests a spelling, for example customer_name for customer name.
{ "customer_name": "Sara" }
Was this page helpful?