Skip to main content

VoiFlow for Python

Run your voice agents from your own backend: create businesses, set up agents, start calls, read transcripts and get webhooks.

pip install voiflow

Python 3.9 or newer, no other packages needed. The client is synchronous and returns plain dicts.

Quickstart

import os
from voiflow import VoiFlowClient

client = VoiFlowClient(api_key=os.environ["VOIFLOW_API_KEY"])

for business in client.businesses.list():
    print(business["id"], business["name"])

call = client.calls.create(
    {"agent_id": "agent_id", "contact_id": "contact_id", "mission": "Confirm tomorrow's visit"},
    business_id="business_id",  # only needed if your key covers more than one business
)
print(call["call_id"], call["status"])  # "starting": the call is accepted, not yet connected

Keys

Create keys in the Partner Portal under Developers. A vf_test_ key works on test data and never places a real call or touches a live business. A vf_live_ key acts on real businesses and real customers. Both are secret: keep them on your server and give browsers a short-lived token from client.sessions.create instead.

A key is either tied to one business or can manage all of yours. With a management key, pass business_id on each call (or create the business first with businesses.create).

Lists

List methods return an iterator and fetch the next page for you.

for call in client.calls.list(days="7"):
    print(call["call_id"])

Errors and retries

Failures raise VoiFlowError with status, code, message, request_id and details. A network failure or an HTTP 202 means the result is not known yet (VoiFlowConnectionError, VoiFlowOperationPending): do not start the action again under a new key. Every method that changes something takes idempotency_key; if you leave it out, one is generated and reused on automatic retries, and it is on the error as err.idempotency_key so you can retry the same action safely.

Webhooks

Create an endpoint with client.webhook_endpoints.create({"url": ..., "event_types": [...]}). The secret is shown once. Events today: call.started, call.completed, agent.published. Check every delivery before you trust it, using the raw body bytes:

from voiflow import verify_webhook_signature, parse_webhook_event

verify_webhook_signature(raw_body, request.headers["VoiFlow-Signature"], secret)  # raises if wrong or older than 5 minutes
event = parse_webhook_event(raw_body)  # event["id"] stays the same on retries: use it to skip duplicates

Before you place calls

Phone calls and browser voice sessions work once VoiFlow has connected a phone line to the business, which VoiFlow does for you during onboarding. Until then calls.create and sessions.create raise a clear error saying so. Webhook endpoints must be public https addresses.

What is in the client

Group Methods
businesses list, create, retrieve, update, readiness, settings, update_settings
agents list, create, retrieve, update, delete, publish, voice_options
journeys list, create, retrieve, update, draft, save_draft, create_version, retrieve_version, publish, impact
calls list, create, retrieve, end, steer, transcript, recording, stream
conversations list, create, retrieve, list_messages, send_message, takeover, resume_ai
contacts list, create, retrieve, update, set_dnc
enquiries list, retrieve
appointments, calendar appointments.list / create; calendar.availability / resources
knowledge, files knowledge.list / create / update / publish; files.list / upload / retrieve / download
projects, campaigns, runs projects.list / create; campaigns.list / create / retrieve / update / set_status / stats; runs.create / retrieve / stats
connections, integrations, channel_accounts, lines connections.list / create / retrieve / update / readiness; integrations.list; channel_accounts.list / create; lines.list / update
ai_work list, retrieve, cancel, requeue
webhook_endpoints, events webhook_endpoints.list / create / retrieve / update / delete / rotate_secret / list_deliveries; events.list / replay
sessions, usage, limits, operations sessions.create; usage.get / costs; limits.get; operations.retrieve

Upload a document: client.files.upload(pdf_bytes, filename="policy.pdf", content_type="application/pdf").

Field names are the same as in the API reference (agent_id, contact_id).

MIT licence.

Metadata

Release files for voiflow 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for voiflow 0.1.0
File Size Uploaded
voiflow-0.1.0.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for voiflow 0.1.0
File Interpreter ABI Platform
voiflow-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / voiflow-0.1.0.tar.gz

Download URL voiflow-0.1.0.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7ed52651d41782681fa9a6c8249df8c8e71ca054d889f74f8af40d7b413d0082
BLAKE2b-256 checksum
How to use checksums
b8b830b2d394dbc71b8575577332a9cdd582023d2e90ed5117ba55fd7d95f6cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / voiflow-0.1.0-py3-none-any.whl

Download URL voiflow-0.1.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e27bde9217f6c1b310b2aee707e4a3289f3614c9a46285406c21ecee91ed564
BLAKE2b-256 checksum
How to use checksums
aa633725ad45ec562d637514be766cc44dedcc166472a62e6a18542265f45c9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page