@jaxisdev/sdk
v1.0.8
Published
Official Jaxis SDK for Node.js - High performance developer-first APIs for SMS, WhatsApp and Billing.
Maintainers
Readme
@jaxisdev/sdk - Official Node.js SDK
The official Jaxis SDK for Node.js. A modern, "developer-first" library offering ultra-low latency integration with Jaxis services, including SMS Gateway, WhatsApp API, and Billing systems (coming soon).
Built specifically for high-performance applications with automatic JWT negotiation, seamless Axios-powered interceptors, and robust TypeScript support.
🚀 Features
- Invisible Authentication: Provide your Cognito credentials or API Key, and the SDK automatically manages token fetching, injection, and rotation via interceptors.
- SMS Gateway SDK: Instant SMS sending with extreme reliability and tracking.
- WhatsApp API Node: Direct access to our WhatsApp business messaging infrastructure.
- Billing & Account Flow: (Próximamente) Native integration with Stripe and Jaxis billing modules.
- Universal compatibility: Shipped as both CJS and ESM.
📦 Installation
npm install @jaxisdev/sdk
# or
yarn add @jaxisdev/sdk
# or
pnpm add @jaxisdev/sdk⚡ Quick Start
import { Jaxis } from '@jaxisdev/sdk';
// 1. Initialize the SDK
// The SDK will handle the Cognito token negotiation in the background!
const jaxis = new Jaxis({
auth: {
username: '[email protected]',
password: 'super-secret-password',
},
// Alternatively, use an API key:
// apiKey: 'jx_live_xxxxxx'
});
// 2. Send an SMS
async function sendWelcomeSMS() {
try {
const response = await jaxis.sms.send({
// Can be a single string or an array: ['+1234567', '+9876543']
to: '+1234567890',
text: 'Welcome to Jaxis!',
});
console.log('Message subid:', response.subid);
} catch (error) {
console.error('Failed to send SMS:', error);
}
}
// 3. Send a WhatsApp Message
async function sendWhatsAppMessage() {
// A. Sending an approved Template
const templateResponse = await jaxis.whatsapp.send({
to: '+1234567890',
text: 'Required fallback literal text for DB tracing', // fallback / mandatory
templateName: 'welcome_template',
language: 'en_US',
components: []
});
console.log('Template Message ID:', templateResponse.id);
// B. Sending standard Text
const textResponse = await jaxis.whatsapp.send({
to: '+1234567890',
text: 'Hello! I am testing the normal Wa-Send API'
});
console.log('Text Message ID:', textResponse.id);
}
sendWelcomeSMS();🔧 Compatibility
Node.js v18.0.0 or higher is required.
The library supports both CommonJS (require) and ES Modules (import).
| Environment | Supported | | --- | --- | | Node.js 18.x | ✅ | | Node.js 20.x | ✅ | | Node.js 22.x | ✅ | | Node.js 24.x | ✅ | | TypeScript | ✅ 5.x+ |
🛠️ API Reference
auth
Managed internally. You can also trigger explicit sign-ins using jaxis.auth.signIn().
sms
jaxis.sms.send(params): Sends an outgoing SMS message.
whatsapp
jaxis.whatsapp.send(params): Sends a generic WhatsApp message. Behaves as text, or as a template iftemplateNameis passed.
📝 License
MIT License. See LICENSE for more details.
