Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

AI Front Desk — Python

The same demo as the root (Node) version, in Python: provision a number, receive signed call webhooks, and view transcripts + recordings — built on the KwickPhone API.

Your API key stays server-side; the browser never sees it.

Files

File What it does
provision.py CLI: provision a number, print its webhook_secret (shown once)
server.py Flask dashboard + webhook receiver + transcript/recording proxies
lib/kp.py tiny KwickPhone API client (server-side)
lib/verify.py webhook signature verification (HMAC + replay guard)

Run

cd python
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env          # then add your KP_API_KEY (from https://kwickphone.com/app/developer)

# 1) Provision a number (prints the webhook_secret ONCE — copy it into .env)
python provision.py +13465551234 346 https://YOUR-PUBLIC-HOST/webhooks/kp

# 2) Run the dashboard + webhook receiver
python server.py              # http://localhost:3000

Webhook signature

KwickPhone signs each webhook: X-KwickPhone-Signature: v1=<hex> is an HMAC-SHA256 over "{timestamp}.{rawBody}" keyed by the number's webhook_secret, with X-KwickPhone-Timestamp (Unix seconds). lib/verify.py recomputes it over the raw body and rejects stale timestamps (replay guard) using a constant-time compare. Always verify over the exact bytes received — not re-serialized JSON.