Discovering StackVerify SMS SDK: Easy SMS in Node.js
I recently stumbled upon StackVerify SMS SDK and decided to give it a try. If you need a simple, reliable way to send SMS from Node.js, this SDK is a gem.
Why I Like StackVerify
- Fast SMS delivery
- Clean REST API
- Works with both CommonJS and ESM
- Fully typed for TypeScript
- Automatic retries and timeout handling
- 20 free SMS every month
Itβs incredibly straightforward to get started β no credit card required.
Installation
npm install stackverify-sms
Requires Node.js 18 or higher.
Quick Start Example
CommonJS
const { StackVerify } = require("stackverify-sms");
const client = new StackVerify({
apiKey: process.env.STACKVERIFY_KEY,
timeout: 20000
});
(async () => {
try {
const res = await client.sms.send({
recipients: ["+254712345678"],
body: "Hello from StackVerify!",
sender_id: "SMS"
});
console.log("SMS sent:", res);
} catch (err) {
console.error("Request failed:", err);
}
})();
TypeScript Example
import { StackVerify, StackVerifyError } from "stackverify-sms";
const client = new StackVerify({
apiKey: process.env.STACKVERIFY_KEY!,
timeout: 5000,
retries: 3
});
async function sendSMS(): Promise<void> {
try {
const response = await client.sms.send({
recipients: ["+254712345678"],
body: "TypeScript SMS example",
sender_id: "MYAPP"
});
console.log("Success:", response);
} catch (error) {
if (error instanceof StackVerifyError) {
console.error("Status:", error.status);
console.error("Message:", error.message);
}
}
}
sendSMS();
Free Developer Credits
Happy coding! π
Top comments (0)