Open in
telephony.incoming / web.incoming
ഇൻബൗണ്ട് കോളിന്റെ കോൺഫിഗറേഷൻ തത്സമയം രൂപപ്പെടുത്തുന്ന ബ്ലോക്കിംഗ് വെബ്ഹുക്ക്.
ഒരു ഇൻബൗണ്ട് ഫോൺ കോൾ നിയോഗിച്ച
ഏജന്റില്ലാത്ത ഒരു നമ്പറിലെത്തുമ്പോഴോ, mode="webhook"-ലുള്ള ഒരു
പ്രസിദ്ധീകരിക്കാവുന്ന കീയിൽ ഒരു വെബ് വിഡ്ജറ്റ് സെഷൻ ആരംഭിക്കുമ്പോഴോ,
ThunderPhone നിങ്ങളുടെ
ലെഗസി വെബ്ഹുക്ക് URL-ലേക്ക് ഒരു തടസ്സപ്പെടുത്തുന്ന
telephony.incoming / web.incoming അഭ്യർത്ഥന അയയ്ക്കുകയും കോൺഫിഗറേഷൻ പ്രതികരണത്തിനായി 10 സെക്കൻഡ് വരെ കാത്തിരിക്കുകയും ചെയ്യുന്നു. ഓരോ കോളിനും prompt, voice, ടൂളുകൾ എന്നിവ ഡൈനാമിക്കായി തിരഞ്ഞെടുക്കാൻ ഈ
കൈമാറ്റം ഉപയോഗിക്കുക — സമഗ്രമായ രീതിക്കായി
ഡൈനാമിക് കോൾ കോൺഫിഗറേഷൻ ഗൈഡ് കാണുക.
തടസ്സപ്പെടുത്തുന്ന ഈ കൈമാറ്റത്തിന് ഫാൾബാക്കില്ല: നിങ്ങളുടെ ഹാൻഡ്ലർ
2xx അല്ലാത്ത സ്റ്റാറ്റസ് നൽകുകയോ, ടൈംഔട്ട് ആകുകയോ, അല്ലെങ്കിൽ വാലിഡേഷൻ
പരാജയപ്പെടുന്ന ഒരു കോൺഫിഗറേഷൻ നൽകുകയോ ചെയ്താൽ, കോൾ നിരസിക്കും (ഫോൺ കോൾ
കണക്റ്റ് ആകില്ല; വിഡ്ജറ്റ് സെഷൻ അഭ്യർത്ഥന 502/422 ഉപയോഗിച്ച് പരാജയപ്പെടും).
വേഗത്തിൽ പ്രതികരിക്കുക — നിങ്ങൾ തീരുമാനിക്കുന്നതിനിടെ കോളർ റിങ്ബാക്ക് കേൾക്കുകയാണ്.
അഭ്യർത്ഥന പേലോഡ്
ഫോൺ കോളുകൾക്കായി (telephony.incoming):
{
"type": "telephony.incoming",
"data": {
"call_id": 987654321,
"from_number": "+14155550199",
"to_number": "+15551234567"
}
}| ഫീൽഡ് | തരം | വിവരണം |
|---|---|---|
call_id | integer | കോൾ id — ഈ കോളിനായുള്ള എല്ലാ ഇവന്റുകളിലും സ്ഥിരമാണ് |
from_number | string | E.164 കോളർ നമ്പർ |
to_number | string | E.164 ലക്ഷ്യസ്ഥാനം (നിങ്ങളുടെ ThunderPhone നമ്പറുകളിൽ ഒന്ന്) |
വെബ് വിഡ്ജറ്റ് സെഷനുകൾക്കായി (web.incoming), data ഫോൺ നമ്പറുകൾക്കുപകരം
എംബെഡ് ചെയ്ത പേജിനെ തിരിച്ചറിയുന്നു:
{
"type": "web.incoming",
"data": {
"call_id": 987654322,
"origin_domain": "https://example.com",
"publishable_key_prefix": "pk_live_a1b2"
}
}| ഫീൽഡ് | തരം | വിവരണം |
|---|---|---|
call_id | integer | കോൾ id |
origin_domain | string | വിഡ്ജറ്റ് ഹോസ്റ്റ് ചെയ്യുന്ന പേജ് ഒറിജിൻ |
publishable_key_prefix | string | സെഷൻ തുറന്ന പ്രസിദ്ധീകരിക്കാവുന്ന കീയുടെ ആദ്യ അക്ഷരങ്ങൾ |
language, primary_language | string | വിഡ്ജറ്റ് സെഷൻ ഭാഷാ ഓവർറൈഡ് അഭ്യർത്ഥിച്ചാൽ ലഭ്യമാകും |
voice | string | വിഡ്ജറ്റ് സെഷൻ വോയ്സ് ഓവർറൈഡ് അഭ്യർത്ഥിച്ചാൽ ലഭ്യമാകും |
website_context | string | വിഡ്ജറ്റ് ഓരോ-സെഷൻ പേജ് കോൺടെക്സ്റ്റ് കൈമാറിയാൽ ലഭ്യമാകും |
പ്രതികരണ സ്കീമ
ഈ കോളിനായുള്ള ഏജന്റ് കോൺഫിഗറേഷൻ വിവരിക്കുന്ന ഒരു JSON ഒബ്ജക്റ്റ് മടക്കിനൽകുക.
prompt, voice എന്നിവ ആവശ്യമാണ്; ബാക്കിയുള്ളവയെല്ലാം ഓപ്ഷണലാണ്.
{
"prompt": "You are a helpful booking assistant for Acme Restaurant.",
"voice": "john",
"product": "spark",
"background_track": null,
"tools": []
}| ഫീൽഡ് | തരം | ആവശ്യമാണ് | വിവരണം |
|---|---|---|---|
prompt | സ്ട്രിംഗ് | അതെ | ഏജന്റിനെ നയിക്കുന്ന സിസ്റ്റം prompt |
voice | സ്ട്രിംഗ് | അതെ | GET /v1/voices-ൽ നിന്നുള്ള വോയ്സ് ഐഡി, ഉദാ. john. voice_name ഒരു അപരനാമമായി സ്വീകരിക്കും. അജ്ഞാത വോയ്സുകൾ സാധുതാ പരിശോധനയിൽ പരാജയപ്പെടുകയും കോൾ നിരസിക്കപ്പെടുകയും ചെയ്യും |
product | സ്ട്രിംഗ് | ഇല്ല | സ്ഥിരസ്ഥിതി spark. അനുവദനീയം: spark, bolt, storm-base, storm-base-with-ack, storm-extra, storm-extra-with-ack |
thinking_level | സ്ട്രിംഗ് | ഇല്ല | minimal, base (സ്ഥിരസ്ഥിതി), അല്ലെങ്കിൽ extra. Storm ഉൽപ്പന്നങ്ങൾക്കായി അസാധുവാക്കും: storm-extra* extra നിർബന്ധിതമാക്കും, മറ്റ് storm-* base നിർബന്ധിതമാക്കും |
audio_context_mode | സ്ട്രിംഗ് | ഇല്ല | full (സ്ഥിരസ്ഥിതി) അല്ലെങ്കിൽ reduced |
watchdog_enabled | ബൂളിയൻ | ഇല്ല | ഈ കോളിനായി മേൽനോട്ടം പ്രവർത്തനക്ഷമമാക്കുക. സ്ഥിരസ്ഥിതി false |
additional_audio_context | ബൂളിയൻ | null | ഇല്ല | ഏറ്റവും സമീപകാല ടേൺ മാത്രം ഉൾപ്പെടുത്തുന്നതിന് പകരം കോളറുടെ ഓഡിയോയിലെ അവസാന കുറച്ച് ടേണുകൾ ഉൾപ്പെടുത്തുക; ചെറിയ ലേറ്റൻസി/ചെലവ് അധികമാകുമെങ്കിലും ഇത് തിരുത്തലുകളും അക്ഷരവിന്യാസം/നമ്പറുകൾ കൂടുതലുള്ള ഡാറ്റാ ശേഖരണവും മെച്ചപ്പെടുത്തുന്നു. ഇൻബൗണ്ട് സെഷനുകളിൽ സ്ഥിരസ്ഥിതിയായി ഓണും ഔട്ട്ബൗണ്ട് ഫോൺ കോളുകളിൽ ഓഫുമാണ്; null സ്ഥിരസ്ഥിതി നിലനിർത്തും |
storm_feedback_mode | സ്ട്രിംഗ് | ഇല്ല | none, acknowledgement (സ്ഥിരസ്ഥിതി), അല്ലെങ്കിൽ tick |
language | സ്ട്രിംഗ് | ഇല്ല | primary_language-നുള്ള ചുരുക്കരൂപം |
primary_language | സ്ട്രിംഗ് | ഇല്ല | ഭാഷാ കോഡ്, സാധാരണവൽക്കരിച്ചത് (സ്ഥിരസ്ഥിതി en). പരിഹരിക്കാനാകാത്ത കോഡുകൾ കോൾ നിരസിക്കും |
has_additional_languages | ബൂളിയൻ | ഇല്ല | സ്ഥിരസ്ഥിതി false |
additional_languages | സ്ട്രിംഗുകളുടെ അറേ | ഇല്ല | ഏജന്റിന് മാറാനാകുന്ന അധിക ഭാഷകൾ |
native_voice_switching | ബൂളിയൻ | ഇല്ല | സ്ഥിരസ്ഥിതി false. കോൾ മറ്റൊരു ഭാഷയിലേക്ക് മാറുമ്പോൾ, കോൺഫിഗർ ചെയ്ത വോയ്സ് നിലനിർത്തുന്നതിന് പകരം ആ ഭാഷയുടെ പ്രാദേശിക വോയ്സിലേക്ക് മാറുക (ലിംഗം അനുസരിച്ച് പൊരുത്തപ്പെടുത്തിയത്) |
background_track | സ്ട്രിംഗ് | null | ഇല്ല | ആംബിയന്റ് ഓഡിയോ ഐഡി അല്ലെങ്കിൽ null |
acknowledgement_prompt_mode | സ്ട്രിംഗ് | ഇല്ല | auto (സ്ഥിരസ്ഥിതി) അല്ലെങ്കിൽ manual (Storm-with-ack ഉൽപ്പന്നങ്ങൾ) |
acknowledgement_prompt | സ്ട്രിംഗ് | ഇല്ല | acknowledgement_prompt_mode="manual" ആയിരിക്കുമ്പോൾ ഉപയോഗിക്കുന്നു |
silence_interval_seconds | ഇന്റിജർ | null | ഇല്ല | 5–120. പരിശോധിക്കുന്നതിന് മുമ്പുള്ള കോളറുടെ നിശ്ശബ്ദതയുടെ സെക്കൻഡുകൾ |
silence_max_checkins | ഇന്റിജർ | null | ഇല്ല | 1–10 |
silence_checkins_enabled | ബൂളിയൻ | ഇല്ല | സ്ഥിരസ്ഥിതി true |
connect_tone_enabled | ബൂളിയൻ | ഇല്ല | സ്ഥിരസ്ഥിതി false |
voicemail_action | സ്ട്രിംഗ് | ഇല്ല | prompt (സ്ഥിരസ്ഥിതി), hangup, അല്ലെങ്കിൽ message |
voicemail_message | സ്ട്രിംഗ് | ഇല്ല | voicemail_action="message" ആയിരിക്കുമ്പോൾ ഉപയോഗിക്കുന്നു |
agent_name | സ്ട്രിംഗ് | ഇല്ല | ഡാഷ്ബോർഡുകളിലും വിജറ്റിലും കാണിക്കുന്ന പ്രദർശന നാമം |
org_name | സ്ട്രിംഗ് | ഇല്ല | ഏജന്റിന്റെ വ്യക്തിത്വത്തിനുള്ള സ്ഥാപന പ്രദർശന നാമം |
tools | അറേ | ഇല്ല | ഇൻലൈൻ ഫങ്ഷൻ-ടൂൾ സ്കീമകൾ (ഫങ്ഷൻ ടൂളുകൾ കാണുക) |
call_id | ഇന്റിജർ | ഇല്ല | അഭ്യർത്ഥനയുടെ കോൾ ഐഡിയുടെ ഓപ്ഷണൽ എക്കോ; അവഗണിക്കും |
prompt, voice എന്നിവ ആവശ്യമായതിനാൽ, {} അല്ലെങ്കിൽ സാധുതാ പരിശോധനയിൽ
പരാജയപ്പെടുന്ന ഏതെങ്കിലും പ്രതികരണം 422 ഉപയോഗിച്ച് കോൾ നിരസിക്കും — ഈ പാതയിൽ
സ്ഥിരമായ ഏജന്റ് ഫാൾബാക്കില്ല (വെബ്ഹുക്ക് മോഡിലെ ഒരു നമ്പറിനോ കീക്കോ നിയോഗിച്ച
ഏജന്റില്ല).
പ്രതികരണ വലുപ്പ പരിധി
ഉദാഹരണ ഹാൻഡ്ലർ
import hashlib
import hmac
import json
import os
from fastapi import FastAPI, HTTPException, Request
app = FastAPI()
WEBHOOK_SECRET = os.environ["THUNDERPHONE_WEBHOOK_SECRET"]
def verify(body: bytes, signature: str) -> bool:
expected = hmac.new(WEBHOOK_SECRET.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature or "")
@app.post("/thunderphone-webhook")
async def webhook(request: Request):
body = await request.body()
if not verify(body, request.headers.get("X-ThunderPhone-Signature", "")):
raise HTTPException(status_code=401)
event = json.loads(body)
if event["type"] == "telephony.incoming":
caller = event["data"]["from_number"]
prompt = (
"Greet the caller as a San Francisco local…"
if caller.startswith("+1415")
else "You are a friendly customer support agent…"
)
return {
"prompt": prompt,
"voice": "john",
"product": "spark",
}
if event["type"] == "web.incoming":
return {
"prompt": "You are the website's helpful voice assistant…",
"voice": "john",
"product": "spark",
}
return {}import crypto from "node:crypto";
import express from "express";
const app = express();
const SECRET = process.env.THUNDERPHONE_WEBHOOK_SECRET;
function verify(body, signature) {
const expected = crypto
.createHmac("sha256", SECRET)
.update(body)
.digest("hex");
return signature &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}
app.post(
"/thunderphone-webhook",
express.raw({ type: "application/json" }),
(req, res) => {
if (!verify(req.body, req.header("X-ThunderPhone-Signature"))) {
return res.sendStatus(401);
}
const event = JSON.parse(req.body.toString("utf8"));
if (event.type === "telephony.incoming" || event.type === "web.incoming") {
const caller = event.data.from_number || "web";
const prompt = caller.startsWith("+1415")
? "Greet the caller as a San Francisco local…"
: "You are a friendly customer support agent…";
return res.json({
prompt,
voice: "john",
product: "spark",
});
}
res.json({});
},
);ഫംഗ്ഷൻ ടൂളുകളുള്ള പ്രതികരണം
സംഭാഷണത്തിനിടെ AI-ക്ക് നിങ്ങളുടെ API-കളെ വിളിക്കാൻ കഴിയുന്ന വിധത്തിൽ ടൂളുകൾ ചേർക്കുക:
{
"prompt": "You are a booking assistant. Use the available tools to help customers schedule appointments.",
"voice": "john",
"product": "spark",
"tools": [
{
"type": "function",
"function": {
"name": "search_appointments",
"description": "Find available appointment slots",
"parameters": {
"type": "object",
"properties": {
"date": { "type": "string", "description": "YYYY-MM-DD" },
"service": { "type": "string" }
},
"required": ["date"]
}
},
"endpoint": {
"url": "https://api.example.com/appointments/search",
"method": "POST",
"headers": {
"X-Api-Key": "your-key"
}
}
}
]
}പ്രൊഡക്റ്റ് ടിയർ ചീറ്റ് ഷീറ്റ്
| പ്രൊഡക്റ്റ് | ലേറ്റൻസി | റീസണിംഗ് | അംഗീകാരം |
|---|---|---|---|
spark | ഏറ്റവും കുറവ് | അടിസ്ഥാന | — |
bolt | കുറവ് | മെച്ചപ്പെടുത്തിയത് | — |
storm-base | മിതം | ശക്തമായ | — |
storm-base-with-ack | മിതം | ശക്തമായ | ചിന്തിക്കുന്നതിനിടെ സ്വയമേവയുള്ള ഫില്ലർ |
storm-extra | കൂടുതൽ | ആഴത്തിലുള്ള | — |
storm-extra-with-ack | കൂടുതൽ | ആഴത്തിലുള്ള | ചിന്തിക്കുന്നതിനിടെ സ്വയമേവയുള്ള ഫില്ലർ |
ബന്ധപ്പെട്ടവ
ബ്ലോക്ക് ചെയ്യാത്ത കോൾ-അവസാന ഇവന്റ്.
tools[]-നുള്ള സമ്പൂർണ്ണ JSON സ്കീമയും ഒപ്പിട്ട എൻഡ്പോയിന്റ് കോൺട്രാക്ടും.
ഒന്നിലധികം URL-ുകളെ telephony.incoming / web.incoming-ലേക്ക് സബ്സ്ക്രൈബ് ചെയ്യുക.
ഓരോ കോളർക്കുമുള്ള prompt-ുകൾ, ടൂളുകൾ, A/B ടെസ്റ്റുകൾ എന്നിവയ്ക്കുള്ള പാറ്റേണുകൾ.