ThunderPhone 2.0 अब लाइव है।सेल्फ़-सर्व, 2¢ प्रति मिनट से शुरू।घोषणा पढ़ें

Getting Started

क्विकस्टार्ट (API)

AI एजेंट के साथ अपनी पहली फोन कॉल का जवाब दें: API key प्राप्त करें, एक एजेंट बनाएँ, फोन नंबर प्रोविज़न करें और लाइव टेस्ट कॉल करें — यह सब REST API के माध्यम से।

यह गाइड आपको उन चार REST कॉल्स के बारे में बताती है जिनकी मदद से आप AI एजेंट के साथ अपनी पहली फोन कॉल का जवाब दे सकते हैं।

चरण 1: API key प्राप्त करें

  1. लॉग इन करें

    app.thunderphone.com खोलें।

  2. Keys पर जाएं

    डैशबोर्ड में संगठन → Keys पर जाएं।

  3. एक key बनाएं

    Create key पर क्लिक करें, इसे एक नाम दें और sk_live_... वैल्यू कॉपी करें। पूरा key केवल एक बार दिखाया जाता है — इसे तुरंत अपने सीक्रेट मैनेजर में स्टोर करें।

इस गाइड में, sk_live_YOUR_API_KEY को उस वैल्यू से बदलें जिसे आपने अभी कॉपी किया है। key आपके संगठन की पहचान अपने-आप करता है, इसलिए आपको URLs में कभी भी org id डालने की जरूरत नहीं होती।

चरण 2: एजेंट बनाएं

एक एजेंट तय करता है कि AI बातचीत को कैसे संभालता है — प्रॉम्प्ट, आवाज़, प्रोडक्ट टियर, टूल्स और विजेट पात्रता।

cURL
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"
  }'
Python
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"])
Node.js
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 कनेक्शन देखें।)

cURL
# 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}'
Python
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: अपने एजेंट का परीक्षण करें

अभी प्रोविज़न किए गए नंबर पर कॉल करें। एजेंट कॉल उठाता है, अपना परिचय देता है और आपके प्रॉम्प्ट का पालन करता है।

कॉल समाप्त होने के बाद उसकी जाँच करें:

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"

अगले चरण