क्विकस्टार्ट (API)
हे मार्गदर्शक तुम्हाला AI एजंटद्वारे तुमचा पहिला फोन कॉल उत्तर देण्यासाठी लागणाऱ्या चार REST कॉल्समधून मार्गदर्शन करते.
पायरी 1: API की मिळवा
- लॉग इन करा
app.thunderphone.com उघडा.
- कीजकडे जा
डॅशबोर्डमध्ये Organization → Keys वर जा.
- की तयार करा
Create key वर क्लिक करा, तिला नाव द्या आणि
sk_live_...मूल्य कॉपी करा. मूळ की फक्त एकदाच दाखवली जाते — ती त्वरित तुमच्या सिक्रेट मॅनेजरमध्ये साठवा.
या संपूर्ण मार्गदर्शकात, sk_live_YOUR_API_KEY ऐवजी तुम्ही नुकतेच कॉपी केलेले मूल्य वापरा.
की तुमची संस्था आपोआप ओळखते, त्यामुळे तुम्हाला URL मध्ये कधीही org id टाकण्याची गरज नाही.
पायरी 2: एजंट तयार करा
एजंट AI संभाषणे कशी हाताळते हे निश्चित करतो — prompt, आवाज, उत्पादन स्तर, साधने आणि विजेट पात्रता.
curl -X POST https://api.thunderphone.com/v1/agents \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Support",
"prompt": "You are a friendly support agent for Acme Corp. Help with orders, returns, and product info. Be concise and helpful.",
"voice": "john",
"product": "spark"
}'
import os, requests
agent = requests.post(
"https://api.thunderphone.com/v1/agents",
headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}"},
json={
"name": "Customer Support",
"prompt": "You are a friendly support agent for Acme Corp. Help with orders, returns, and product info. Be concise and helpful.",
"voice": "john",
"product": "spark",
},
).json()
print("Agent id:", agent["id"])
const agent = await fetch("https://api.thunderphone.com/v1/agents", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.THUNDERPHONE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Customer Support",
prompt: "You are a friendly support agent for Acme Corp. Help with orders, returns, and product info. Be concise and helpful.",
voice: "john",
product: "spark",
}),
}).then((r) => r.json());
console.log("Agent id:", agent.id);
पायरी 3: फोन नंबर प्रोव्हिजन करा
हा कॉल नंबरसाठी ThunderPhone च्या डेमो पूलकडे विनंती करतो आणि तुमच्या नवीन एजंटला इनबाउंड हँडलर म्हणून नियुक्त करतो. (VoIP प्रदात्याकडून तुमचा स्वतःचा नंबर आणण्यासाठी, त्याऐवजी VoIP कनेक्शन पहा.)
# First provision
curl -X POST https://api.thunderphone.com/v1/phone-numbers \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"area_code": "415"}'
# Then assign the agent you created in Step 2
curl -X PATCH https://api.thunderphone.com/v1/phone-numbers/<id-from-previous> \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inbound_agent_id": 12}'
number = requests.post(
"https://api.thunderphone.com/v1/phone-numbers",
headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}"},
json={"area_code": "415"},
).json()
requests.patch(
f"https://api.thunderphone.com/v1/phone-numbers/{number['id']}",
headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}"},
json={"inbound_agent_id": agent["id"]},
)
print("Your ThunderPhone number:", number["number"])
तुमचा नवीन नंबर status="provisioning" मध्ये सुरू होतो आणि काही सेकंदांत
active मध्ये बदलतो; तुम्ही ब्राउझर बंद करेपर्यंत नंबर कॉल स्वीकारण्यासाठी
तयार असतो.
पायरी 4 (ऐच्छिक): वेबहुक सेट अप करा
रिअल-टाइम इव्हेंटसाठी (डायनॅमिक कॉल रूटिंग, कॉलनंतरची प्रक्रिया) वेबहुक एंडपॉइंट जोडा. तुम्हाला आवश्यक असलेल्या इव्हेंट्सचेच सदस्यत्व घ्या.
curl -X POST https://api.thunderphone.com/v1/developer/webhook-endpoints \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "Prod webhook",
"url": "https://your-server.com/thunderphone-webhook",
"events": ["telephony.incoming", "telephony.complete"]
}'
प्रतिसादात एकदाच वापरता येणारा secret असतो — तो तुमच्या सिक्रेट
मॅनेजरमध्ये कॉपी करा. येणाऱ्या विनंत्यांवरील X-ThunderPhone-Signature
हेडर सत्यापित करण्यासाठी तो सिक्रेट वापरा (पहा
वेबहुक विहंगावलोकन).
पायरी 5: तुमच्या एजंटची चाचणी घ्या
तुम्ही नुकताच प्रोव्हिजन केलेल्या नंबरवर कॉल करा. एजंट कॉल उचलतो, स्वतःची ओळख करून देतो आणि तुमच्या prompt चे पालन करतो.
कॉल संपल्यानंतर त्याची तपासणी करा:
curl https://api.thunderphone.com/v1/calls \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
ट्रान्स्क्रिप्ट आणि रेकॉर्डिंग URL मिळवण्यासाठी विशिष्ट कॉलचे तपशील उघडा:
curl https://api.thunderphone.com/v1/calls/{call_id}/transcript \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
curl https://api.thunderphone.com/v1/calls/{call_id}/audio \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"