Node.js, Python and PHP API integration
Connect ResalaHub with your existing HTTP client. Use the same authenticated JSON API from Node.js, Python, PHP or any server environment that supports HTTPS.
Use your language’s HTTP tools
No official ResalaHub SDK package is published. You do not need an @outbox/sdk or @resalahub/sdk dependency. Use fetch in Node.js, requests in Python or cURL in PHP and send a Bearer API key from your server.
A consistent request shape
Fetch GET /v1/sms/phones and use a returned phone ID, not the SIM number, in phoneId. Supply to and text to POST /v1/sms. The server generates the request ID automatically. Save the returned id to check message status later.
Handle retries deliberately
If you need duplicate-request protection, generate a UUID requestId before sending and reuse it only for that SMS. Without requestId, each submission creates a new request. Never retry an uncertain WhatsApp submission automatically; inspect its history first.
const response = await fetch(process.env.RESALAHUB_URL + "/v1/sms", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESALAHUB_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
phoneId: "YOUR_PHONE_ID",
to: "+966502214471", text: "Your booking is confirmed."
})
});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
console.log(result.id);