ತ್ವರಿತ ಆರಂಭ (API)

ಈ ಮಾರ್ಗದರ್ಶಿ AI ಏಜೆಂಟ್‌ನೊಂದಿಗೆ ನಿಮ್ಮ ಮೊದಲ ಫೋನ್ ಕರೆಯನ್ನು ಸ್ವೀಕರಿಸಲು ಬೇಕಾಗುವ ನಾಲ್ಕು REST ಕರೆಗಳ ಮೂಲಕ ನಿಮ್ಮನ್ನು ನಡೆಸುತ್ತದೆ.

ಹಂತ 1: API ಕೀ ಪಡೆಯಿರಿ

  1. ಲಾಗ್ ಇನ್ ಮಾಡಿ

    app.thunderphone.com ತೆರೆಯಿರಿ.

  2. ಕೀಲಿಗಳಿಗೆ ಹೋಗಿ

    ಡ್ಯಾಶ್‌ಬೋರ್ಡ್‌ನಲ್ಲಿ ಸಂಸ್ಥೆ → ಕೀಲಿಗಳು ಗೆ ಹೋಗಿ.

  3. ಕೀ ರಚಿಸಿ

    ಕೀ ರಚಿಸಿ ಕ್ಲಿಕ್ ಮಾಡಿ, ಅದಕ್ಕೆ ಹೆಸರು ನೀಡಿ, ಮತ್ತು sk_live_... ಮೌಲ್ಯವನ್ನು ನಕಲಿಸಿ. ಮೂಲ ಕೀಯನ್ನು ಒಮ್ಮೆ ಮಾತ್ರ ತೋರಿಸಲಾಗುತ್ತದೆ — ಅದನ್ನು ತಕ್ಷಣವೇ ನಿಮ್ಮ ಸೀಕ್ರೆಟ್ ಮ್ಯಾನೇಜರ್‌ನಲ್ಲಿ ಸಂಗ್ರಹಿಸಿ.

ಈ ಮಾರ್ಗದರ್ಶಿಯಾದ್ಯಂತ, sk_live_YOUR_API_KEY ಅನ್ನು ನೀವು ಈಗಷ್ಟೇ ನಕಲಿಸಿದ ಮೌಲ್ಯದೊಂದಿಗೆ ಬದಲಾಯಿಸಿ. ಕೀಯು ನಿಮ್ಮ ಸಂಸ್ಥೆಯನ್ನು ಸ್ವಯಂಚಾಲಿತವಾಗಿ ಗುರುತಿಸುತ್ತದೆ, ಆದ್ದರಿಂದ ನೀವು URL ಗಳಲ್ಲಿ ಎಂದಿಗೂ ಸಂಸ್ಥೆಯ 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"

ಮುಂದಿನ ಹಂತಗಳು