Webhook એન્ડપોઇન્ટ્સ
એન્ડપૉઇન્ટ-આધારિત વેબહૂક સિસ્ટમ તમને દરેક સંસ્થા માટે એકથી વધુ ગંતવ્યો નોંધવાની સુવિધા આપે છે, જેમાં દરેકનો પોતાનો સિક્રેટ, પોતાનું સ્ટેટસ અને ઇવેન્ટ પ્રકારોના ઉપસેટ માટે પોતાનું સબ્સ્ક્રિપ્શન હોય છે. તમામ નવી ઇન્ટિગ્રેશનો માટે આ ભલામણ કરાયેલ મોડેલ છે.
લેગસી સિંગલ-URL વેબહૂક સાથે સરખામણી કરો, જે બેકવર્ડ કમ્પેટિબિલિટી માટે રાખવામાં આવ્યું છે પરંતુ દરેક સંસ્થા માટે માત્ર એક URL સપોર્ટ કરે છે.
એન્ડપૉઇન્ટ્સ
| પદ્ધતિ | પાથ | આવશ્યક ભૂમિકા | વર્ણન |
|---|---|---|---|
GET | /v1/developer/webhook-endpoints | admin+ | એન્ડપૉઇન્ટ્સની સૂચિ |
POST | /v1/developer/webhook-endpoints | admin+ | એન્ડપૉઇન્ટ બનાવો |
PATCH | /v1/developer/webhook-endpoints/{endpoint_id} | admin+ | લેબલ / URL / ઇવેન્ટ્સ / સ્ટેટસ અપડેટ કરો |
DELETE | /v1/developer/webhook-endpoints/{endpoint_id} | admin+ | એન્ડપૉઇન્ટ કાઢી નાખો |
POST | /v1/developer/webhook-endpoints/{endpoint_id}/test | admin+ | સાઇન કરેલી ટેસ્ટ ડિલિવરી મોકલો |
એન્ડપૉઇન્ટ ઑબ્જેક્ટ
{
"id": "c4d5e6f7-...",
"label": "Production — Call events",
"url": "https://example.com/thunderphone/hook",
"events": ["telephony.incoming", "telephony.complete"],
"status": "active",
"secret_hint": "a1b2…9f0e",
"created_at": "2026-04-20T18:24:10.113Z",
"updated_at": "2026-04-20T18:24:10.113Z"
}
| ફીલ્ડ | પ્રકાર | વર્ણન |
|---|---|---|
id | UUID | એન્ડપૉઇન્ટ ID |
label | સ્ટ્રિંગ | ડિસ્પ્લે નામ, 1–120 અક્ષરો |
url | સ્ટ્રિંગ | HTTPS URL; ડેવલપમેન્ટ માટે http://localhost માન્ય છે |
events | સ્ટ્રિંગનો એરે | સબ્સ્ક્રાઇબ કરેલા ઇવેન્ટ પ્રકારો (માન્ય મૂલ્યો જુઓ). ખાલી એરે તમામ ઇવેન્ટ્સ માટે સબ્સ્ક્રાઇબ કરે છે |
status | સ્ટ્રિંગ | active, disabled (મેન્યુઅલી થોભાવેલ), અથવા failing (જ્યારે કોઈ ડિલિવરી એક પણ 2xx વિના તેનું 24 કલાકનું રિટ્રાય શેડ્યૂલ પૂર્ણ કરે ત્યારે ઑટો-સેટ થાય છે) |
secret_hint | સ્ટ્રિંગ | એલિપ્સિસ (a1b2…9f0e) સાથે સાઇનિંગ સિક્રેટના પ્રથમ 4 અને છેલ્લા 4 અક્ષરો — સંપૂર્ણ મૂલ્ય જાહેર કર્યા વિના તમે સ્થાનિક રીતે સાચવેલા સિક્રેટ સાથે ક્રોસ-રેફરન્સ કરવા માટે પૂરતું |
created_at, updated_at | ટાઇમસ્ટેમ્પ |
માન્ય ઇવેન્ટ પ્રકારો
events આ ચોક્કસ સેટ સામે વૅલિડેટ થાય છે — સૂચિની બહારના મૂલ્યો
400 પરત કરે છે. દરેક પ્રકારના પેલોડ આકાર માટે ઇવેન્ટ્સ કૅટલૉગ જુઓ.
telephony.incoming,telephony.complete,telephony.toolweb.incoming,web.complete,web.toolcall.gradedissue.reportedtest-call.completedalert.triggered
એન્ડપૉઇન્ટ સ્ટેટસ
active— ડિલિવરીઝ સામાન્ય રીતે ચાલુ રહે છે.disabled—PATCHદ્વારા મેન્યુઅલી થોભાવેલ. કોઈ રિક્વેસ્ટ મોકલાતી નથી. અમે ક્યારેયdisabledએન્ડપૉઇન્ટનું સ્ટેટસ બદલતા નથી; તેને પાછુંactiveકરવું હંમેશા તમારો નિર્ણય છે.failing— જ્યારે એન્ડપૉઇન્ટ પરની ડિલિવરીને એક પણ 2xx મળ્યા વિના તેનું સંપૂર્ણ રિટ્રાય શેડ્યૂલ (24 કલાકમાં 8 પ્રયાસો) પૂર્ણ થાય ત્યારે આપમેળે સેટ થાય છે. નિષ્ફળ એન્ડપૉઇન્ટને વધુ કોઈ ટ્રાફિક મળતો નથી. એન્ડપૉઇન્ટ ઠીક થઈ જાય પછી, તેના સ્ટેટસનેPATCHદ્વારા પાછુંactiveકરો; જે ડિલિવરીઝનું રિટ્રાય શેડ્યૂલ હજી સમાપ્ત થયું નથી તે જ્યાં અટકી હતી ત્યાંથી ફરી શરૂ થાય છે.
એન્ડપૉઇન્ટ્સની સૂચિ
curl https://api.thunderphone.com/v1/developer/webhook-endpoints \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
એન્ડપૉઇન્ટ ઑબ્જેક્ટ્સનો એરે પરત કરે છે.
એન્ડપોઇન્ટ બનાવો
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": "Production — Call events",
"url": "https://example.com/thunderphone/hook",
"events": ["telephony.incoming", "telephony.complete"]
}'
result = requests.post(
"https://api.thunderphone.com/v1/developer/webhook-endpoints",
headers={"Authorization": "Bearer sk_live_YOUR_API_KEY"},
json={
"label": "Production — Call events",
"url": "https://example.com/thunderphone/hook",
"events": ["telephony.incoming", "telephony.complete"],
},
).json()
secret = result["secret"]
endpoint_id = result["id"]
વિનંતી ક્ષેત્રો
| ક્ષેત્ર | પ્રકાર | આવશ્યક | વર્ણન |
|---|---|---|---|
label | સ્ટ્રિંગ | હા | 1–120 અક્ષરો |
url | સ્ટ્રિંગ | હા | HTTPS URL (http માત્ર localhost / 127.0.0.1 માટે માન્ય છે) |
events | એરે | ના | ખાલી/છોડવામાં આવેલું હોય તો તમામ ઇવેન્ટ્સ માટે સબ્સ્ક્રાઇબ થાય છે. માન્ય ઇવેન્ટ પ્રકારોમાં સૂચિબદ્ધ મૂલ્યોનો ઉપયોગ કરવો આવશ્યક છે; ડુપ્લિકેટ્સ દૂર કરવામાં આવે છે |
એન્ડપોઇન્ટ ઑબ્જેક્ટ સાથે 201 Created પરત કરે છે, ઉપરાંત
કાચી સાઇનિંગ કી ધરાવતું વધારાનું ટોચ-સ્તરનું secret ક્ષેત્ર — એક
48-અક્ષરની હેક્સ સ્ટ્રિંગ:
{
"id": "c4d5e6f7-…",
"label": "Production — Call events",
"url": "https://example.com/thunderphone/hook",
"events": ["telephony.incoming", "telephony.complete"],
"status": "active",
"secret_hint": "a1b2…9f0e",
"created_at": "2026-04-20T18:24:10.113Z",
"updated_at": "2026-04-20T18:24:10.113Z",
"secret": "a1b2c37e08d94f5b16a2c8d90e7f3a4b5c6d7e8f90a19f0e"
}
એન્ડપોઇન્ટ અપડેટ કરો
curl -X PATCH https://api.thunderphone.com/v1/developer/webhook-endpoints/c4d5e6f7-... \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "Production — Call + Grade events",
"events": ["telephony.incoming", "telephony.complete", "call.graded"]
}'
| ક્ષેત્ર | પ્રકાર | વર્ણન |
|---|---|---|
label | સ્ટ્રિંગ | |
url | સ્ટ્રિંગ | |
events | એરે | |
status | સ્ટ્રિંગ | active અથવા disabled. સર્વરે failing તરીકે ચિહ્નિત કરેલા એન્ડપોઇન્ટને ફરી સક્રિય કરવા active સેટ કરો |
અપડેટ કરેલા એન્ડપોઇન્ટ ઑબ્જેક્ટ સાથે 200 OK પરત કરે છે.
પરીક્ષણ ડિલિવરી મોકલો
કેનોનિકલ JSON સીરિયલાઇઝેશન,
X-ThunderPhone-Signature, ડિલિવરી રેકોર્ડિંગ અને રીટ્રાય હિસાબકિતાબ સહિત,
સામાન્ય ડિલિવરી પાઇપલાઇનનો ઉપયોગ કરીને એક એન્ડપોઇન્ટ પર કૃત્રિમ webhook.test ઇવેન્ટ મોકલો.
પરીક્ષણ તેના events ફિલ્ટરને ધ્યાનમાં લીધા વિના પસંદ કરેલા એન્ડપોઇન્ટને લક્ષ્ય બનાવે છે.
curl -X POST https://api.thunderphone.com/v1/developer/webhook-endpoints/c4d5e6f7-.../test \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
એન્ડપોઇન્ટને આના જેવું એન્વલપ મળે છે:
{
"data": {
"message": "ThunderPhone webhook test",
"sent_at": "2026-07-17T20:12:34.567890+00:00"
},
"event_id": "2ad6507c-7d19-4498-9b2d-7e8f944ab5a1",
"type": "webhook.test"
}
ગંતવ્ય ભૂલ પરત કરે તો પણ, API પ્રથમ પ્રયાસ પછી 200 OK પરત કરે છે.
ડિલિવરીનું પરિણામ જોવા માટે success, status, response_code, અને error
તપાસો:
{
"success": true,
"event_id": "2ad6507c-7d19-4498-9b2d-7e8f944ab5a1",
"event_type": "webhook.test",
"status": "delivered",
"response_code": 204,
"error": ""
}
webhook.test કૃત્રિમ છે અને તેને એન્ડપોઇન્ટના events
સબ્સ્ક્રિપ્શનમાં ઉમેરી શકાતું નથી. પ્રથમ પ્રયાસ નિષ્ફળ જાય તો, ડિલિવરી સામાન્ય ઇવેન્ટ ડિલિવરીઓ જેવી જ
રીટ્રાય સમયસૂચિને અનુસરે છે.
એન્ડપોઇન્ટ કાઢી નાખો
curl -X DELETE https://api.thunderphone.com/v1/developer/webhook-endpoints/c4d5e6f7-... \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
204 No Content પરત કરે છે. URL પર ડિલિવરી તરત બંધ થઈ જાય છે;
ચાલુ રીટ્રાય રદ કરવામાં આવે છે.