Server
Server SDK
Set up voxioagent/server to manage flows and read sessions from your own backend.
voxioagent/server manages your flows and reads their sessions and usage. It runs on Node 18 or later, or any edge runtime with fetch.
Before you begin
You need:
- Your account key, from Developers in the dashboard.
- Node 18 or later.
Install the package
npm install voxioagentStore your account key
Keep the account key out of your code. Set it as an environment variable:
export VOXIO_SECRET_KEY="ACCOUNT_KEY"Replace ACCOUNT_KEY with your account key.
Create a client
Create the client with the key from the environment:
import { Voxio } from "voxioagent/server";
export const voxio = new Voxio({ secretKey: process.env.VOXIO_SECRET_KEY, environment: "gpu" });To check it works, read one of your flows:
const flow = await voxio.flows.get("YOUR_FLOW_KEY", { keys: ["flow_name"] });console.log(flow.flow_name); // → SupportReplace YOUR_FLOW_KEY with your flow key, from the flow's Overview in the dashboard.
If you only read one flow's sessions and usage, its flow key is enough: new Voxio({ flowKey, environment: "gpu" }).
Options
secretKeystring- Your account key. Needed to create, change, delete or rotate flows.
flowKeystring- A default flow key for reading sessions and usage.
environment"standard" | "gpu"- Use
gpu: the data service runs there. endpoints{ data? }- Overrides the data service.
timeoutMsnumber- The timeout for each request. Default: 15000.
maxRetriesnumber- Retries for reads that fail with 429 or 5xx. Default: 2. Writes are never retried.
fetchtypeof fetch- Your own fetch, for tests or proxies.
Next steps
- Flows: create, change and delete flows.
- Sessions and usage: read transcripts and usage.