Examples#
Complete, runnable flows against the staging API.
Adjust the hold announcement and listen to it#
bash
API="https://api.callfluence.staging.bestbrandseverywhere.com"
# 1. Set your own text — the analysis comes right back in the response
curl -s -X PUT -H "Content-Type: application/json" -H "X-Tenant: bbe" \
-d '{"text": "Einen Moment bitte, Ihr Anliegen wird sofort weiterbearbeitet."}' \
"$API/v2/audio/scripts/call.hold"
# 2. Listen to it as audio
curl -s -X POST -H "Content-Type: application/json" -H "X-Tenant: bbe" \
-d '{"touchpoint": "call.hold"}' "$API/v2/audio/render" -o hold.mp3Check all scripts with quality analysis#
bash
curl -s -H "X-Tenant: bbe" "$API/v2/audio/scripts?analyze=1" \
| python3 -c "import json,sys; d=json.load(sys.stdin); \
[print(a['id'], a['durationSec'], 's', [f['rule'] for f in a['findings']]) for a in d['analysis']]"Simulate a callback lead from the website#
bash
curl -s -X POST -H "Content-Type: application/json" \
-d '{
"tenant": "bbe", "kind": "callback",
"phone": "+491701234567", "preferred_at": "30min",
"page_url": "https://kunde.example/preise"
}' "$API/v2/public/leads"
# Pick it up in the console and mark it contacted
curl -s -H "X-Tenant: bbe" "$API/v2/leads"
curl -s -X PATCH -H "Content-Type: application/json" -H "X-Tenant: bbe" \
-d '{"status": "contacted"}' "$API/v2/leads/ld_XXXXXXXX"TTS-STT round trip (verification)#
bash
curl -s -X POST -H "Content-Type: application/json" -H "X-Tenant: bbe" \
-d '{"touchpoint": "web.lead.success"}' "$API/v2/audio/render" -o roundtrip.mp3
python3 - <<'EOF'
import base64, json
body = {"audio_base64": base64.b64encode(open("roundtrip.mp3","rb").read()).decode(), "filename": "roundtrip.mp3"}
open("stt.json","w").write(json.dumps(body))
EOF
curl -s -X POST -H "Content-Type: application/json" -H "X-Tenant: bbe" \
--data-binary @stt.json "$API/v2/audio/transcribe"Test the widget on a page#
html
<!doctype html>
<html lang="de">
<body>
<h1>Test page</h1>
<script src="https://api.callfluence.staging.bestbrandseverywhere.com/widget/callfluence-widget.js"
data-tenant="bbe" defer></script>
</body>
</html>