New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

stackverify

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stackverify - npm Package Compare versions

Comparing version
1.0.3
to
2.0.0
+82
README.md
# StackVerify SDK
A simple Node.js SDK to interact with the StackVerify API for sending SMS and checking message status.
## Installation
```bash
npm install stackverify
```
# Usage
Get your apikey .
- [@stackverify](https://stackverify.site)
```
import 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();
```
# Api
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)
## Badges
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/)
[![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
## Authors
- [@morgan miller](https://www.github.com/Frost-bit-star)
- [@samwuel simiyu](https://github.com/Trojan-254)
## 🔗 Links
[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/)
[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/)
+1
-1
{
"name": "stackverify",
"version": "1.0.3",
"version": "2.0.0",
"description": "Node.js SDK for StackVerify API (SMS, Email, WhatsApp)",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -6,4 +6,6 @@ import fetch from "node-fetch";

if (!apiKey) throw new Error("API key is required");
this.apiKey = apiKey;
this.baseUrl = baseUrl.replace(/\/+$/, "");
this.mode = apiKey.startsWith("sk_test_") ? "test" : "live";
}

@@ -20,22 +22,59 @@

const text = await res.text().catch(() => null);
let data;
try {
data = await res.json();
} catch {
data = null;
}
if (!res.ok) throw new Error(`StackVerify SDK Error: ${text || res.status}`);
try { return JSON.parse(text); } catch { return text; }
if (!res.ok) {
const error = new Error(data?.message || "StackVerify API Error");
error.status = res.status;
error.error = data?.error || null;
error.retry_after = data?.retry_after || null;
throw error;
}
return data;
}
async sendSMS({ recipients, body, sender_id }) {
if (!recipients || !Array.isArray(recipients) || recipients.length === 0)
/**
* Send SMS
* Required permission: sms:send
*/
async sendSMS({
recipients,
body,
sender_id,
templateId,
scheduleAt,
}) {
if (!Array.isArray(recipients) || recipients.length === 0)
throw new Error("recipients must be a non-empty array");
if (!body) throw new Error("body is required");
if (!sender_id) throw new Error("sender_id is required");
if (!body && !templateId)
throw new Error("Either body or templateId is required");
if (!sender_id)
throw new Error("sender_id is required");
return this._request("/sms/send", {
method: "POST",
body: JSON.stringify({ recipients, body, sender_id }),
body: JSON.stringify({
recipients,
body,
sender_id,
templateId,
scheduleAt,
}),
});
}
/**
* Get SMS Status
* Required permission: sms:read
*/
async getSMSStatus(messageId) {
if (!messageId) throw new Error("messageId is required");
return this._request(`/sms/status/${encodeURIComponent(messageId)}`);

@@ -42,0 +81,0 @@ }

# StackVerify SDK
A simple Node.js SDK to interact with the StackVerify API for sending SMS and checking message status.
## Installation
```bash
npm install stackverify
```
# Usage
```
import 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();
```
# Api
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)
## Badges
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/)
[![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
## Authors
- [@morgan miller](https://www.github.com/Frost-bit-star)
- [@samwuel simiyu](https://github.com/Trojan-254)
## 🔗 Links
[![website](https://img.shields.io/badge/my_portfolio-000?style=for-the-badge&logo=ko-fi&logoColor=white)](https://stackverify.site/)
[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/)
[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/)