Open in
क्विकस्टार्ट (API)
AI एजेंट के साथ अपनी पहली फोन कॉल का जवाब दें: API key प्राप्त करें, एक एजेंट बनाएं, फोन नंबर प्रोविजन करें, और लाइव टेस्ट कॉल करें — यह सब REST API के माध्यम से।
यह गाइड आपको उन चार REST कॉल्स के माध्यम से ले जाती है जिनकी मदद से आप किसी AI एजेंट के साथ अपनी पहली फोन कॉल का जवाब दे सकते हैं।
चरण 1: API key प्राप्त करें
- लॉग इन करें
app.thunderphone.com खोलें।
- कीज़ पर जाएँ
डैशबोर्ड में संगठन → कीज़ पर जाएँ।
- एक की बनाएँ
की बनाएँ पर क्लिक करें, उसे एक नाम दें, और
sk_live_...वैल्यू कॉपी करें। रॉ की केवल एक बार दिखाई जाती है — इसे तुरंत अपने सीक्रेट मैनेजर में स्टोर करें।
इस गाइड में, sk_live_YOUR_API_KEY को उस वैल्यू से बदलें जिसे आपने अभी
कॉपी किया है। की आपके संगठन की पहचान अपने-आप करती है, इसलिए
आपको कभी भी URLs में org id डालने की जरूरत नहीं होती।
चरण 2: एक एजेंट बनाएँ
एक एजेंट यह निर्धारित करता है कि AI बातचीत को कैसे संभालता है — प्रॉम्प्ट, वॉइस, प्रोडक्ट टियर, टूल्स और विजेट पात्रता।
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-V2
हेडर को वेरिफ़ाई करने के लिए उस सीक्रेट का उपयोग करें (देखें
Webhooks ओवरव्यू)।
चरण 5: अपने एजेंट का परीक्षण करें
जिस नंबर को आपने अभी प्रोविज़न किया है उस पर कॉल करें। एजेंट कॉल उठाता है, अपना परिचय देता है और आपके प्रॉम्प्ट का पालन करता है।
कॉल समाप्त होने के बाद उसका निरीक्षण करें:
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"