cURL
curl --request POST \
--url https://api.aicaller.io/v1/phoneCalls/batch \
--header 'Content-Type: application/json' \
--header 'aicaller-api-key: <api-key>' \
--data '
{
"phoneCalls": [
{
"teamId": "363573667364666473667332",
"callTemplateId": "363573667364666473667332",
"nameOfHuman": "John",
"toPhoneNumber": "+1234567890",
"promptVariableValues": [
{
"key": "customer_name",
"value": "John"
}
],
"phoneNumberId": "363573667364666473667332",
"fromPhoneNumber": "+1234567890",
"toEmailAddress": "[email protected]",
"status": "queued",
"telephonyProvider": "twilio",
"record": false,
"callDelayedUntil": "2023-10-12T09:08:00.387Z",
"phoneCallWebhooks": [
{
"url": "https://hooks.abc.com/",
"subscribedEvent": "phoneCall.completed",
"secret": "NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12"
}
]
}
]
}
'import requests
url = "https://api.aicaller.io/v1/phoneCalls/batch"
payload = { "phoneCalls": [
{
"teamId": "363573667364666473667332",
"callTemplateId": "363573667364666473667332",
"nameOfHuman": "John",
"toPhoneNumber": "+1234567890",
"promptVariableValues": [
{
"key": "customer_name",
"value": "John"
}
],
"phoneNumberId": "363573667364666473667332",
"fromPhoneNumber": "+1234567890",
"toEmailAddress": "[email protected]",
"status": "queued",
"telephonyProvider": "twilio",
"record": False,
"callDelayedUntil": "2023-10-12T09:08:00.387Z",
"phoneCallWebhooks": [
{
"url": "https://hooks.abc.com/",
"subscribedEvent": "phoneCall.completed",
"secret": "NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12"
}
]
}
] }
headers = {
"aicaller-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'aicaller-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phoneCalls: [
{
teamId: '363573667364666473667332',
callTemplateId: '363573667364666473667332',
nameOfHuman: 'John',
toPhoneNumber: '+1234567890',
promptVariableValues: [{key: 'customer_name', value: 'John'}],
phoneNumberId: '363573667364666473667332',
fromPhoneNumber: '+1234567890',
toEmailAddress: '[email protected]',
status: 'queued',
telephonyProvider: 'twilio',
record: false,
callDelayedUntil: '2023-10-12T09:08:00.387Z',
phoneCallWebhooks: [
{
url: 'https://hooks.abc.com/',
subscribedEvent: 'phoneCall.completed',
secret: 'NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12'
}
]
}
]
})
};
fetch('https://api.aicaller.io/v1/phoneCalls/batch', 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.aicaller.io/v1/phoneCalls/batch",
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([
'phoneCalls' => [
[
'teamId' => '363573667364666473667332',
'callTemplateId' => '363573667364666473667332',
'nameOfHuman' => 'John',
'toPhoneNumber' => '+1234567890',
'promptVariableValues' => [
[
'key' => 'customer_name',
'value' => 'John'
]
],
'phoneNumberId' => '363573667364666473667332',
'fromPhoneNumber' => '+1234567890',
'toEmailAddress' => '[email protected]',
'status' => 'queued',
'telephonyProvider' => 'twilio',
'record' => false,
'callDelayedUntil' => '2023-10-12T09:08:00.387Z',
'phoneCallWebhooks' => [
[
'url' => 'https://hooks.abc.com/',
'subscribedEvent' => 'phoneCall.completed',
'secret' => 'NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"aicaller-api-key: <api-key>"
],
]);
$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.aicaller.io/v1/phoneCalls/batch"
payload := strings.NewReader("{\n \"phoneCalls\": [\n {\n \"teamId\": \"363573667364666473667332\",\n \"callTemplateId\": \"363573667364666473667332\",\n \"nameOfHuman\": \"John\",\n \"toPhoneNumber\": \"+1234567890\",\n \"promptVariableValues\": [\n {\n \"key\": \"customer_name\",\n \"value\": \"John\"\n }\n ],\n \"phoneNumberId\": \"363573667364666473667332\",\n \"fromPhoneNumber\": \"+1234567890\",\n \"toEmailAddress\": \"[email protected]\",\n \"status\": \"queued\",\n \"telephonyProvider\": \"twilio\",\n \"record\": false,\n \"callDelayedUntil\": \"2023-10-12T09:08:00.387Z\",\n \"phoneCallWebhooks\": [\n {\n \"url\": \"https://hooks.abc.com/\",\n \"subscribedEvent\": \"phoneCall.completed\",\n \"secret\": \"NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("aicaller-api-key", "<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.aicaller.io/v1/phoneCalls/batch")
.header("aicaller-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phoneCalls\": [\n {\n \"teamId\": \"363573667364666473667332\",\n \"callTemplateId\": \"363573667364666473667332\",\n \"nameOfHuman\": \"John\",\n \"toPhoneNumber\": \"+1234567890\",\n \"promptVariableValues\": [\n {\n \"key\": \"customer_name\",\n \"value\": \"John\"\n }\n ],\n \"phoneNumberId\": \"363573667364666473667332\",\n \"fromPhoneNumber\": \"+1234567890\",\n \"toEmailAddress\": \"[email protected]\",\n \"status\": \"queued\",\n \"telephonyProvider\": \"twilio\",\n \"record\": false,\n \"callDelayedUntil\": \"2023-10-12T09:08:00.387Z\",\n \"phoneCallWebhooks\": [\n {\n \"url\": \"https://hooks.abc.com/\",\n \"subscribedEvent\": \"phoneCall.completed\",\n \"secret\": \"NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aicaller.io/v1/phoneCalls/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["aicaller-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phoneCalls\": [\n {\n \"teamId\": \"363573667364666473667332\",\n \"callTemplateId\": \"363573667364666473667332\",\n \"nameOfHuman\": \"John\",\n \"toPhoneNumber\": \"+1234567890\",\n \"promptVariableValues\": [\n {\n \"key\": \"customer_name\",\n \"value\": \"John\"\n }\n ],\n \"phoneNumberId\": \"363573667364666473667332\",\n \"fromPhoneNumber\": \"+1234567890\",\n \"toEmailAddress\": \"[email protected]\",\n \"status\": \"queued\",\n \"telephonyProvider\": \"twilio\",\n \"record\": false,\n \"callDelayedUntil\": \"2023-10-12T09:08:00.387Z\",\n \"phoneCallWebhooks\": [\n {\n \"url\": \"https://hooks.abc.com/\",\n \"subscribedEvent\": \"phoneCall.completed\",\n \"secret\": \"NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"teamId": "363573667364666473667332",
"callTemplateId": "363573667364666473667332",
"nameOfHuman": "John",
"toPhoneNumber": "+1234567890",
"promptVariableValues": [
{
"key": "customer_name",
"value": "John"
}
],
"_id": "12345678901234567890",
"createdAt": "<string>",
"updatedAt": "<string>",
"phoneNumberId": "363573667364666473667332",
"fromPhoneNumber": "+1234567890",
"toEmailAddress": "[email protected]",
"status": "queued",
"telephonyProvider": "twilio",
"record": false,
"callDelayedUntil": "2023-10-12T09:08:00.387Z",
"phoneCallWebhooks": [
{
"url": "https://hooks.abc.com/",
"subscribedEvent": "phoneCall.completed",
"secret": "NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12"
}
]
}
]
}{
"error": {
"statusCode": 400,
"message": [
"Invalid input"
],
"error": "Bad Request"
},
"payload": {}
}{
"error": {
"statusCode": 401,
"message": [
"Unauthorized"
],
"error": "Unauthorized"
},
"payload": {}
}{
"error": {
"statusCode": 403,
"message": [
"Forbidden resource"
],
"error": "Forbidden"
},
"payload": {}
}{
"error": {
"statusCode": 404,
"message": [
"Not Found"
],
"error": "Not Found"
},
"payload": {}
}{
"error": {
"error": "Internal Server Error",
"message": [
"INTERNAL_ERROR"
],
"statusCode": 500
},
"payload": {}
}Phone Calls
Post Batch Phonecall
Create multiple PhoneCalls in one request
POST
/
v1
/
phoneCalls
/
batch
cURL
curl --request POST \
--url https://api.aicaller.io/v1/phoneCalls/batch \
--header 'Content-Type: application/json' \
--header 'aicaller-api-key: <api-key>' \
--data '
{
"phoneCalls": [
{
"teamId": "363573667364666473667332",
"callTemplateId": "363573667364666473667332",
"nameOfHuman": "John",
"toPhoneNumber": "+1234567890",
"promptVariableValues": [
{
"key": "customer_name",
"value": "John"
}
],
"phoneNumberId": "363573667364666473667332",
"fromPhoneNumber": "+1234567890",
"toEmailAddress": "[email protected]",
"status": "queued",
"telephonyProvider": "twilio",
"record": false,
"callDelayedUntil": "2023-10-12T09:08:00.387Z",
"phoneCallWebhooks": [
{
"url": "https://hooks.abc.com/",
"subscribedEvent": "phoneCall.completed",
"secret": "NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12"
}
]
}
]
}
'import requests
url = "https://api.aicaller.io/v1/phoneCalls/batch"
payload = { "phoneCalls": [
{
"teamId": "363573667364666473667332",
"callTemplateId": "363573667364666473667332",
"nameOfHuman": "John",
"toPhoneNumber": "+1234567890",
"promptVariableValues": [
{
"key": "customer_name",
"value": "John"
}
],
"phoneNumberId": "363573667364666473667332",
"fromPhoneNumber": "+1234567890",
"toEmailAddress": "[email protected]",
"status": "queued",
"telephonyProvider": "twilio",
"record": False,
"callDelayedUntil": "2023-10-12T09:08:00.387Z",
"phoneCallWebhooks": [
{
"url": "https://hooks.abc.com/",
"subscribedEvent": "phoneCall.completed",
"secret": "NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12"
}
]
}
] }
headers = {
"aicaller-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'aicaller-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phoneCalls: [
{
teamId: '363573667364666473667332',
callTemplateId: '363573667364666473667332',
nameOfHuman: 'John',
toPhoneNumber: '+1234567890',
promptVariableValues: [{key: 'customer_name', value: 'John'}],
phoneNumberId: '363573667364666473667332',
fromPhoneNumber: '+1234567890',
toEmailAddress: '[email protected]',
status: 'queued',
telephonyProvider: 'twilio',
record: false,
callDelayedUntil: '2023-10-12T09:08:00.387Z',
phoneCallWebhooks: [
{
url: 'https://hooks.abc.com/',
subscribedEvent: 'phoneCall.completed',
secret: 'NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12'
}
]
}
]
})
};
fetch('https://api.aicaller.io/v1/phoneCalls/batch', 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.aicaller.io/v1/phoneCalls/batch",
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([
'phoneCalls' => [
[
'teamId' => '363573667364666473667332',
'callTemplateId' => '363573667364666473667332',
'nameOfHuman' => 'John',
'toPhoneNumber' => '+1234567890',
'promptVariableValues' => [
[
'key' => 'customer_name',
'value' => 'John'
]
],
'phoneNumberId' => '363573667364666473667332',
'fromPhoneNumber' => '+1234567890',
'toEmailAddress' => '[email protected]',
'status' => 'queued',
'telephonyProvider' => 'twilio',
'record' => false,
'callDelayedUntil' => '2023-10-12T09:08:00.387Z',
'phoneCallWebhooks' => [
[
'url' => 'https://hooks.abc.com/',
'subscribedEvent' => 'phoneCall.completed',
'secret' => 'NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"aicaller-api-key: <api-key>"
],
]);
$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.aicaller.io/v1/phoneCalls/batch"
payload := strings.NewReader("{\n \"phoneCalls\": [\n {\n \"teamId\": \"363573667364666473667332\",\n \"callTemplateId\": \"363573667364666473667332\",\n \"nameOfHuman\": \"John\",\n \"toPhoneNumber\": \"+1234567890\",\n \"promptVariableValues\": [\n {\n \"key\": \"customer_name\",\n \"value\": \"John\"\n }\n ],\n \"phoneNumberId\": \"363573667364666473667332\",\n \"fromPhoneNumber\": \"+1234567890\",\n \"toEmailAddress\": \"[email protected]\",\n \"status\": \"queued\",\n \"telephonyProvider\": \"twilio\",\n \"record\": false,\n \"callDelayedUntil\": \"2023-10-12T09:08:00.387Z\",\n \"phoneCallWebhooks\": [\n {\n \"url\": \"https://hooks.abc.com/\",\n \"subscribedEvent\": \"phoneCall.completed\",\n \"secret\": \"NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("aicaller-api-key", "<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.aicaller.io/v1/phoneCalls/batch")
.header("aicaller-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phoneCalls\": [\n {\n \"teamId\": \"363573667364666473667332\",\n \"callTemplateId\": \"363573667364666473667332\",\n \"nameOfHuman\": \"John\",\n \"toPhoneNumber\": \"+1234567890\",\n \"promptVariableValues\": [\n {\n \"key\": \"customer_name\",\n \"value\": \"John\"\n }\n ],\n \"phoneNumberId\": \"363573667364666473667332\",\n \"fromPhoneNumber\": \"+1234567890\",\n \"toEmailAddress\": \"[email protected]\",\n \"status\": \"queued\",\n \"telephonyProvider\": \"twilio\",\n \"record\": false,\n \"callDelayedUntil\": \"2023-10-12T09:08:00.387Z\",\n \"phoneCallWebhooks\": [\n {\n \"url\": \"https://hooks.abc.com/\",\n \"subscribedEvent\": \"phoneCall.completed\",\n \"secret\": \"NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aicaller.io/v1/phoneCalls/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["aicaller-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phoneCalls\": [\n {\n \"teamId\": \"363573667364666473667332\",\n \"callTemplateId\": \"363573667364666473667332\",\n \"nameOfHuman\": \"John\",\n \"toPhoneNumber\": \"+1234567890\",\n \"promptVariableValues\": [\n {\n \"key\": \"customer_name\",\n \"value\": \"John\"\n }\n ],\n \"phoneNumberId\": \"363573667364666473667332\",\n \"fromPhoneNumber\": \"+1234567890\",\n \"toEmailAddress\": \"[email protected]\",\n \"status\": \"queued\",\n \"telephonyProvider\": \"twilio\",\n \"record\": false,\n \"callDelayedUntil\": \"2023-10-12T09:08:00.387Z\",\n \"phoneCallWebhooks\": [\n {\n \"url\": \"https://hooks.abc.com/\",\n \"subscribedEvent\": \"phoneCall.completed\",\n \"secret\": \"NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"teamId": "363573667364666473667332",
"callTemplateId": "363573667364666473667332",
"nameOfHuman": "John",
"toPhoneNumber": "+1234567890",
"promptVariableValues": [
{
"key": "customer_name",
"value": "John"
}
],
"_id": "12345678901234567890",
"createdAt": "<string>",
"updatedAt": "<string>",
"phoneNumberId": "363573667364666473667332",
"fromPhoneNumber": "+1234567890",
"toEmailAddress": "[email protected]",
"status": "queued",
"telephonyProvider": "twilio",
"record": false,
"callDelayedUntil": "2023-10-12T09:08:00.387Z",
"phoneCallWebhooks": [
{
"url": "https://hooks.abc.com/",
"subscribedEvent": "phoneCall.completed",
"secret": "NjUyOTgwMjkpJU0NmY25yzWkJFWDBE12"
}
]
}
]
}{
"error": {
"statusCode": 400,
"message": [
"Invalid input"
],
"error": "Bad Request"
},
"payload": {}
}{
"error": {
"statusCode": 401,
"message": [
"Unauthorized"
],
"error": "Unauthorized"
},
"payload": {}
}{
"error": {
"statusCode": 403,
"message": [
"Forbidden resource"
],
"error": "Forbidden"
},
"payload": {}
}{
"error": {
"statusCode": 404,
"message": [
"Not Found"
],
"error": "Not Found"
},
"payload": {}
}{
"error": {
"error": "Internal Server Error",
"message": [
"INTERNAL_ERROR"
],
"statusCode": 500
},
"payload": {}
}⌘I
