A simple Node.js SDK to interact with the StackVerify API for sending SMS and checking message status.
npm install stackverifyimport StackVerify from "stackverify";
// Initialize the SDK
const stack = new StackVerify({ apiKey: "YOUR_API_KEY" });
// Send an SMS and check status
async function main() {
try {
const response = await stack.sendSMS({
recipients: ["+1234567890"], // array of phone numbers
body: "Hello! This is a test message.",
sender_id: "SMS"
});
console.log("SMS sent:", response);
const status = await stack.getSMSStatus(response.message_id);
console.log("SMS status:", status);
} catch (err) {
console.error("Error:", err.message);
}
}
main();
new StackVerify({ apiKey, baseUrl })
apiKey (string) — Your StackVerify API key (required)
baseUrl (string) — API base URL (default: https://stackverify.site/api/v1)
sendSMS({ recipients, body, sender_id })
Send an SMS.
recipients — array of phone numbers (required)
body — SMS message text (required)
sender_id — your sender ID (required)
getSMSStatus(messageId)
Get the status of a sent message.
messageId — ID returned by sendSMS (required)