sms-gateway-sdk
v1.3.0
Published
JavaScript SDK to interact with a FastAPI-based SMS Gateway using ESP32 and GSM module.
Maintainers
Readme
sms-gateway-sdk
sms-gateway-sdk is a simple JavaScript SDK to interact with an SMS Gateway powered by FastAPI, ESP32, and a GSM module.
It allows you to send SMS messages, view the inbox, and retrieve logs from your Node.js applications.
Installation
Install it via npm:
npm install sms-gateway-sdk📡 SMS Gateway SDK for JavaScript
A lightweight JavaScript SDK to interact with a FastAPI-based SMS gateway powered by ESP32 and GSM module.
🚀 Features
- ✅ Send SMS messages
- 📥 Fetch received messages (inbox)
- 📊 Retrieve logs
- 🔐 API key-based authentication
🔧 How to Use
1. Import and Initialize the SDK
const SMSGatewayClient = require('sms-gateway-sdk');
// Replace with gateway base URL and API key
const client = new SMSGatewayClient('http://gateway-ip:8000', 'your-api-key');2. Send an SMS
client.sendSMS('+213700000000', 'Hello from JavaScript SDK!')
.then(response => {
console.log('SMS sent successfully:', response);
})
.catch(error => {
console.error('Error sending SMS:', error.message);
});3. Get Received Messages (Inbox)
client.getInbox()
.then(messages => {
messages.forEach(msg => {
console.log(`From: ${msg.sender} - ${msg.message}`);
});
})
.catch(error => {
console.error('Error fetching inbox:', error.message);
});4. Get Logs
client.getLogs()
.then(logs => {
console.log('Gateway logs:');
console.log(logs);
})
.catch(error => {
console.error('Error fetching logs:', error.message);
});✅ Requirements
- Node.js v14+
- Uses
axiosfor HTTP requests
📃 License
Licensed under the MIT License.
🤝 Contributing
Pull requests and feedback are welcome!
Feel free to fork the repo and submit your improvements.
