tsp-scale-sdk
v1.2.3
Published
Official Node.js client for TSP Scale Email and WhatsApp API
Maintainers
Readme
tsp-scale-sdk
Official Node.js SDK for TSP Scale.
🚀 Quick Start (Zero-Config)
Initialize your project in seconds. This will link your project, create a secure hidden config, and add it to your .gitignore automatically.
npx tsp-scale-sdk initManual Installation
If you prefer manual setup:
npm install tsp-scale-sdk🛠️ Usage
const { TspScaleClient } = require('tsp-scale-sdk');
// Authenticates automatically from local config or environment variables
const client = new TspScaleClient();
async function sendTest() {
const res = await client.sendEmail({
to: "[email protected]",
subject: "Hello from TSP Scale",
html: "<h1>It works!</h1>"
});
console.log(res);
}
run().catch(console.error);Note: The
fromfield is optional if your API Key is locked to a specific sender identity.
WhatsApp Messaging
const { TspScaleClient } = require("tsp-scale-sdk");
const client = new TspScaleClient({
apiKey: process.env.TSP_API_KEY
});
async function run() {
const result = await client.sendWhatsApp({
to: "919988776655",
text: "Hello from TSP Scale!",
// mediaUrl: "https://example.com/image.jpg" // Optional
});
console.log(result);
}
run().catch(console.error);Notes
- The SDK automatically adds signed security headers required by the
/emails/sendAPI. - Direct calls to
/emails/sendwithout SDK signature headers are rejected by the backend.
