SDKs & libraries
Use the official SDK, or call the REST API directly from any language. Both are first-class.
JavaScript & TypeScript
npm install @pesarails/smsimport { Pesarails } from "@pesarails/sms";
const sms = new Pesarails(process.env.PESARAILS_KEY);
// Send
await sms.send({ to: "254712345678", sender: "PESARAILS", message: "Hi" });
// Bulk
await sms.sendBulk({
sender: "PESARAILS",
messages: [{ to: "254712345678", text: "Hi" }],
});
// Balance
const { balanceKes } = await sms.balance();The SDK is typed, isomorphic (Node, Bun, Cloudflare Workers and the browser), and mirrors the REST API one to one.
Any other language
There is no lock-in. Every feature is a plain HTTPS request with a bearer token.
curl https://api.sms.pesarails.com/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "to": "254712345678", "sender": "PESARAILS", "message": "Hi" }'Note
PHP (Laravel) and Python packages are on the roadmap. Need one sooner? Email sales@pesarails.com and we will prioritise it.