ThunderPhone 2.0 באוויר.בשירות עצמי, החל מ-2¢/דקה.קראו את הודעת ההשקה

Getting Started

התחלה מהירה (API)

ענו לשיחת הטלפון הראשונה שלכם באמצעות סוכן AI: קבלו מפתח API, צרו סוכן, הקצו מספר טלפון ובצעו שיחת בדיקה חיה — הכול דרך REST API.

מדריך זה מלווה אתכם בארבע קריאות ה-REST הנדרשות כדי לענות לשיחת הטלפון הראשונה שלכם עם סוכן AI.

שלב 1: קבלו מפתח API

  1. התחברו

    פתחו את app.thunderphone.com.

  2. עברו אל מפתחות

    עברו אל ארגון → מפתחות בלוח הבקרה.

  3. צרו מפתח

    לחצו על יצירת מפתח, תנו לו שם והעתיקו את הערך sk_live_.... המפתח הגולמי מוצג פעם אחת בלבד — שמרו אותו מיד במנהל הסודות שלכם.

לאורך המדריך הזה, החליפו את sk_live_YOUR_API_KEY בערך שהעתקתם זה עתה. המפתח מזהה את הארגון שלכם אוטומטית, לכן לעולם אינכם צריכים להוסיף מזהה ארגון לכתובות URL.

שלב 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 (אופציונלי): הגדירו webhook

לאירועים בזמן אמת (ניתוב שיחות דינמי, עיבוד לאחר שיחה), הוסיפו נקודת קצה של webhook. הירשמו רק לאירועים הדרושים לכם.

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"

השלבים הבאים