Integration Guides
Vox Stack works with any programming language. Use standard HTTP requests - no SDK required.
JavaScript/Node.js
Use fetch or any HTTP client library
const API_KEY = 'your-api-key';
const BASE_URL = 'https://voxstack.dev/api/v1';
async function createAgent(name, prompt) {
const response = await fetch(`${BASE_URL}/agents`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name,
system_prompt: prompt,
enabled: true
})
});
return await response.json();
}
async function makeCall(agentId, phoneNumber, contextData) {
// Create task
const taskResponse = await fetch(`${BASE_URL}/tasks`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
agent_id: agentId,
name: 'Outbound Call',
to_number: phoneNumber,
context_data: contextData
})
});
const task = await taskResponse.json();
// Execute task
const executeResponse = await fetch(
`${BASE_URL}/tasks/${task.data.task.id}/execute`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
return await executeResponse.json();
}WebSocket Example
// WebSocket connection for live transcripts
const ws = new WebSocket(
`wss://voxstack.dev/ws/calls/${callId}?api_key=${API_KEY}`
);
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.type === 'transcript_update') {
console.log('Transcript:', message.data.transcript);
}
};Python
Use the requests library for HTTP calls
import requests
API_KEY = 'your-api-key'
BASE_URL = 'https://voxstack.dev/api/v1'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
def create_agent(name, prompt):
response = requests.post(
f'{BASE_URL}/agents',
headers=headers,
json={
'name': name,
'system_prompt': prompt,
'enabled': True
}
)
return response.json()
def make_call(agent_id, phone_number, context_data):
# Create task
task_response = requests.post(
f'{BASE_URL}/tasks',
headers=headers,
json={
'agent_id': agent_id,
'name': 'Outbound Call',
'to_number': phone_number,
'context_data': context_data
}
)
task = task_response.json()
# Execute task
execute_response = requests.post(
f'{BASE_URL}/tasks/{task["data"]["task"]["id"]}/execute',
headers=headers
)
return execute_response.json()WebSocket Example
# WebSocket connection for live transcripts
import websocket
import json
def on_message(ws, message):
data = json.loads(message)
if data['type'] == 'transcript_update':
print('Transcript:', data['data']['transcript'])
ws = websocket.WebSocketApp(
f'wss://voxstack.dev/ws/calls/{call_id}?api_key={API_KEY}',
on_message=on_message
)
ws.run_forever()cURL
Use cURL for quick testing and shell scripts
# Create an agent
curl -X POST "https://voxstack.dev/api/v1/agents" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Service Agent",
"system_prompt": "You are a helpful customer service agent.",
"enabled": true
}'
# Create a task
curl -X POST "https://voxstack.dev/api/v1/tasks" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "your-agent-id",
"name": "Follow-up Call",
"to_number": "+1234567890",
"context_data": {
"customer_name": "John Doe"
}
}'
# Execute the task
curl -X POST "https://voxstack.dev/api/v1/tasks/TASK_ID/execute" \
-H "Authorization: Bearer YOUR_API_KEY"PHP
Use cURL or Guzzle HTTP client
<?php
$apiKey = 'your-api-key';
$baseUrl = 'https://voxstack.dev/api/v1';
function createAgent($name, $prompt) {
global $apiKey, $baseUrl;
$ch = curl_init("$baseUrl/agents");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $apiKey",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => $name,
'system_prompt' => $prompt,
'enabled' => true
]));
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
function makeCall($agentId, $phoneNumber, $contextData) {
global $apiKey, $baseUrl;
// Create task
$ch = curl_init("$baseUrl/tasks");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $apiKey",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'agent_id' => $agentId,
'name' => 'Outbound Call',
'to_number' => $phoneNumber,
'context_data' => $contextData
]));
$response = curl_exec($ch);
$task = json_decode($response, true);
curl_close($ch);
// Execute task
$ch = curl_init("$baseUrl/tasks/{$task['data']['task']['id']}/execute");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $apiKey"
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
?>Ruby
Use the net/http or httparty gem
require 'net/http'
require 'json'
require 'uri'
API_KEY = 'your-api-key'
BASE_URL = 'https://voxstack.dev/api/v1'
def create_agent(name, prompt)
uri = URI("#{BASE_URL}/agents")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{API_KEY}"
request['Content-Type'] = 'application/json'
request.body = {
name: name,
system_prompt: prompt,
enabled: true
}.to_json
response = http.request(request)
JSON.parse(response.body)
end
def make_call(agent_id, phone_number, context_data)
# Create task
uri = URI("#{BASE_URL}/tasks")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{API_KEY}"
request['Content-Type'] = 'application/json'
request.body = {
agent_id: agent_id,
name: 'Outbound Call',
to_number: phone_number,
context_data: context_data
}.to_json
response = http.request(request)
task = JSON.parse(response.body)
# Execute task
uri = URI("#{BASE_URL}/tasks/#{task['data']['task']['id']}/execute")
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{API_KEY}"
response = http.request(request)
JSON.parse(response.body)
endNeed Help?
Vox Stack uses standard REST APIs and WebSocket connections, so it works with any language or framework. If you don't see your language here, you can use any HTTP client library.