REST API ready. Use
requests or httpx against the REST API. We will add a packaged SDK after the REST surface is stable.Python SDK
Python - list agentspy
700 font-semibold">import os
700 font-semibold">import requests
res = requests.get(
"https://flooai.com/api/v1/agents",
headers={"Authorization": f"Bearer {os.environ[700 font-semibold">class="text-emerald-700">'FLOO_API_KEY']}"},
)
res.raise_for_status()
print(res.json())Python - outbound call with variablespy
payload = {
"agent_id": "agt_xxx",
"to_number": "+15551234567",
"from_number_id": "pn_xxx",
"variables": {
"first_name": "Alex",
"appointment_time": "Tuesday at 3pm",
},
}
res = requests.post(
"https://flooai.com/api/v1/calls/outbound",
headers={"Authorization": f"Bearer {os.environ[700 font-semibold">class="text-emerald-700">'FLOO_API_KEY']}"},
json=payload,
)Python - verify a webhook signaturepy
700 font-semibold">import hmac, hashlib
700 font-semibold">def verify_webhook(body: bytes, signature_header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
700 font-semibold">return hmac.compare_digest(expected, signature_header)