1import{b as r,v as c,y as s,j as e,u as o,O as u,_ as l,g as d,k as a,S as n}from"./vendor-vue-DXkV8it4.js";const m={class:"min-h-screen bg-gray-50 py-8"},g={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"},x={class:"mb-8"},p={class:"flex mb-4","aria-label":"Breadcrumb"},h={class:"inline-flex items-center space-x-1 md:space-x-3"},v={class:"inline-flex items-center"},y={class:"flex items-center"},b={class:"grid grid-cols-1 lg:grid-cols-3 gap-8"},f={class:"lg:col-span-1 space-y-6"},w={class:"bg-white shadow rounded-lg p-6"},q={class:"bg-white shadow rounded-lg p-6"},_={__name:"Documentation",setup(k){return(i,t)=>(c(),r("div",m,[s(o(u),{title:"Webhook Documentation"}),e("div",g,[e("div",x,[e("nav",p,[e("ol",h,[e("li",v,[s(o(n),{href:"/",class:"text-gray-700 hover:text-gray-900"},{default:d(()=>t[0]||(t[0]=[a(" Home ")])),_:1})]),e("li",null,[e("div",y,[t[2]||(t[2]=e("svg",{class:"w-6 h-6 text-gray-400",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z","clip-rule":"evenodd"})],-1)),s(o(n),{href:i.route("webhooks.index"),class:"ml-1 text-gray-700 hover:text-gray-900 md:ml-2"},{default:d(()=>t[1]||(t[1]=[a(" Webhooks ")])),_:1},8,["href"])])]),t[3]||(t[3]=l('<li aria-current="page"><div class="flex items-center"><svg class="w-6 h-6 text-gray-400" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg><span class="ml-1 text-gray-500 md:ml-2">Documentation</span></div></li>',1))])]),t[4]||(t[4]=e("h1",{class:"text-3xl font-bold text-gray-900"},"Webhook Documentation",-1)),t[5]||(t[5]=e("p",{class:"mt-2 text-lg text-gray-600"},"API documentation for receiving SMS webhooks",-1))]),e("div",b,[t[11]||(t[11]=l(`<div class="lg:col-span-2 space-y-8"><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Overview</h2><p class="text-gray-700">When you receive an SMS message on your hired number, JuicySMS will send a webhook notification to your configured webhook URL. This allows you to process incoming messages in real-time.</p></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Webhook Payload</h2><p class="text-gray-700 mb-4">Each webhook request contains the following JSON payload:</p><pre class="bg-gray-100 p-4 rounded-md overflow-x-auto"><code class="text-sm">{ 2 "data": { 3 "sms": { 4 "id": 1234567, 5 "body": "Your verification code is 123456", 6 "sender": "1234567890", 7 "received_at": "2024-01-15T10:30:00+00:00" 8 }, 9 "phone": { 10 "number": "+31612345678", 11 "country": "NL" 12 }, 13 "contract": { 14 "id": 12345, 15 "expires_at": "2024-02-15T10:30:00+00:00" 16 } 17 }, 18 "event": "sms.received", 19 "webhook": { 20 "id": 1, 21 "attempt": 1 22 }, 23 "timestamp": "2024-01-15T10:30:00+00:00" 24}</code></pre></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Payload Structure</h2><div class="space-y-4"><div><h3 class="text-lg font-medium text-gray-900 mb-2">data.sms</h3><dl class="grid grid-cols-1 gap-x-4 gap-y-2 text-sm"><div><dt class="inline font-medium text-gray-600">id:</dt><dd class="inline text-gray-900 ml-1">Unique identifier for the SMS message</dd></div><div><dt class="inline font-medium text-gray-600">body:</dt><dd class="inline text-gray-900 ml-1">The full text content of the SMS</dd></div><div><dt class="inline font-medium text-gray-600">sender:</dt><dd class="inline text-gray-900 ml-1">Phone number that sent the SMS</dd></div><div><dt class="inline font-medium text-gray-600">received_at:</dt><dd class="inline text-gray-900 ml-1">ISO 8601 timestamp when SMS was received</dd></div></dl></div><div><h3 class="text-lg font-medium text-gray-900 mb-2">data.phone</h3><dl class="grid grid-cols-1 gap-x-4 gap-y-2 text-sm"><div><dt class="inline font-medium text-gray-600">number:</dt><dd class="inline text-gray-900 ml-1">Your hired phone number that received the SMS</dd></div><div><dt class="inline font-medium text-gray-600">country:</dt><dd class="inline text-gray-900 ml-1">Country code (e.g., NL, UK, USA)</dd></div></dl></div><div><h3 class="text-lg font-medium text-gray-900 mb-2">data.contract</h3><dl class="grid grid-cols-1 gap-x-4 gap-y-2 text-sm"><div><dt class="inline font-medium text-gray-600">id:</dt><dd class="inline text-gray-900 ml-1">Your rental contract ID</dd></div><div><dt class="inline font-medium text-gray-600">expires_at:</dt><dd class="inline text-gray-900 ml-1">ISO 8601 timestamp when the rental expires</dd></div></dl></div><div><h3 class="text-lg font-medium text-gray-900 mb-2">webhook</h3><dl class="grid grid-cols-1 gap-x-4 gap-y-2 text-sm"><div><dt class="inline font-medium text-gray-600">id:</dt><dd class="inline text-gray-900 ml-1">Unique webhook delivery ID</dd></div><div><dt class="inline font-medium text-gray-600">attempt:</dt><dd class="inline text-gray-900 ml-1">Current delivery attempt number (1-3)</dd></div></dl></div></div></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Request Details</h2><dl class="grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-2"><div class="sm:col-span-1"><dt class="text-sm font-medium text-gray-500">Method</dt><dd class="mt-1 text-sm text-gray-900">POST</dd></div><div class="sm:col-span-1"><dt class="text-sm font-medium text-gray-500">Content-Type</dt><dd class="mt-1 text-sm text-gray-900">application/json</dd></div><div class="sm:col-span-1"><dt class="text-sm font-medium text-gray-500">Timeout</dt><dd class="mt-1 text-sm text-gray-900">10 seconds</dd></div><div class="sm:col-span-1"><dt class="text-sm font-medium text-gray-500">Retries</dt><dd class="mt-1 text-sm text-gray-900">Up to 3 attempts with exponential backoff</dd></div></dl></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Expected Response</h2><p class="text-gray-700">Your webhook endpoint should return a 2xx status code (200-299) to acknowledge receipt. Any other status code will be considered a failure and trigger a retry.</p></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Security</h2><p class="text-gray-700 mb-4">We recommend implementing the following security measures:</p><ul class="list-disc list-inside space-y-2 text-gray-700"><li>Use HTTPS for your webhook URL</li><li>Validate the request origin</li><li>Implement request signature verification (coming soon)</li></ul></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Example Implementation</h2><p class="text-gray-700 mb-4">Here's a simple PHP example of handling webhooks:</p><pre class="bg-gray-100 p-4 rounded-md overflow-x-auto"><code class="text-sm"><?php 25// Get the raw POST data 26$payload = file_get_contents('php://input'); 27$data = json_decode($payload, true); 28 29// Check if it's an SMS received event 30if ($data['event'] === 'sms.received') { 31 // Extract SMS details 32 $smsId = $data['data']['sms']['id']; 33 $smsBody = $data['data']['sms']['body']; 34 $sender = $data['data']['sms']['sender']; 35 $receivedAt = $data['data']['sms']['received_at']; 36 37 // Extract phone details 38 $phoneNumber = $data['data']['phone']['number']; 39 $country = $data['data']['phone']['country']; 40 41 // Extract contract details 42 $contractId = $data['data']['contract']['id']; 43 44 // Your processing logic here 45 // For example: save to database, forward to another service, etc. 46 47 // Return success response 48 http_response_code(200); 49 echo json_encode(['status' => 'received']); 50} else { 51 // Handle other event types or return error 52 http_response_code(400); 53 echo json_encode(['error' => 'Unknown event type']); 54} 55?></code></pre></div><div class="bg-white shadow rounded-lg p-6"><h2 class="text-xl font-semibold text-gray-900 mb-4">Testing</h2><p class="text-gray-700">You can test your webhook implementation using the test feature in the webhook dashboard. Configure your webhook URL and click the "Test" button to send a test payload to your endpoint.</p></div></div>`,1)),e("div",f,[e("div",w,[t[7]||(t[7]=e("h3",{class:"text-lg font-semibold text-gray-900 mb-4"},"Quick Links",-1)),s(o(n),{href:i.route("webhooks.index"),class:"text-blue-600 hover:text-blue-800 flex items-center"},{default:d(()=>t[6]||(t[6]=[e("svg",{class:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})],-1),a(" Webhook Dashboard ")])),_:1},8,["href"])]),e("div",q,[t[9]||(t[9]=e("h3",{class:"text-lg font-semibold text-gray-900 mb-4"},"Need Help?",-1)),t[10]||(t[10]=e("p",{class:"text-gray-700 mb-4"},"If you need assistance with webhook integration, please contact our support team.",-1)),s(o(n),{href:i.route("support"),class:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},{default:d(()=>t[8]||(t[8]=[a(" Contact Support ")])),_:1},8,["href"])])])])])]))}};export{_ as default}; 56//# sourceMappingURL=Documentation-Dwymv5pW.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.