A modern Node.js runtime has fetch built in, so sending an SMS needs no extra
dependency.
const response = await fetch("https://your-domain.example/api/v1/messages", {
method: "POST",
headers: {
"Authorization": "Bearer swl_live_YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
recipient: "255700000000",
sender_id: "YOURBRAND",
body: "Your order has shipped.",
}),
});
const data = await response.json();
console.log(data);
The API key is a Bearer token created from your account. Keep it in an environment variable rather than committing it to source control.
See SMS API Tanzania for the full endpoint reference.


