ThunderPhone 2.0 હવે લાઇવ છે.સેલ્ફ-સર્વ, 2¢/મિનિટથી.જાહેરાત વાંચો

Getting Started

ક્વિકસ્ટાર્ટ (API)

AI એજન્ટ સાથે તમારો પ્રથમ ફોન કૉલ સંભાળો: API કી મેળવો, એજન્ટ બનાવો, ફોન નંબર પ્રોવિઝન કરો અને લાઇવ ટેસ્ટ કૉલ કરો — આ બધું REST API દ્વારા.

આ માર્ગદર્શિકા તમને AI એજન્ટ સાથે તમારો પ્રથમ ફોન કૉલ જવાબ આપવા માટે જરૂરી ચાર REST કૉલ્સ સમજાવે છે.

પગલું 1: API કી મેળવો

  1. લૉગ ઇન કરો

    app.thunderphone.com ખોલો.

  2. Keys પર જાઓ

    ડેશબોર્ડમાં Organization → Keys પર જાઓ.

  3. કી બનાવો

    Create key પર ક્લિક કરો, તેને નામ આપો અને sk_live_... મૂલ્ય કૉપી કરો. કાચી કી ફક્ત એક જ વાર દેખાય છે — તેને તરત જ તમારા સિક્રેટ મેનેજરમાં સંગ્રહિત કરો.

આ માર્ગદર્શિકા દરમિયાન, sk_live_YOUR_API_KEYને તમે હમણાં કૉપી કરેલા મૂલ્યથી બદલો. કી તમારી સંસ્થાને આપમેળે ઓળખે છે, તેથી તમારે URLsમાં ક્યારેય org id ઉમેરવાની જરૂર નથી.

પગલું 2: એજન્ટ બનાવો

એજન્ટ નક્કી કરે છે કે AI વાતચીત કેવી રીતે સંભાળે છે — prompt, અવાજ, પ્રોડક્ટ ટિયર, ટૂલ્સ અને વિજેટ પાત્રતા.

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: તમારા એજન્ટનું પરીક્ષણ કરો

તમે હમણાં જ પ્રોવિઝન કરેલા નંબર પર કૉલ કરો. એજન્ટ કૉલ ઉપાડે છે, પોતાનો પરિચય આપે છે અને તમારા 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"

આગળનાં પગલાં