Skip to content

jeryjs/jain-sms-api

Repository files navigation

Jain SMS API

Standalone Express-based SMS API for Jain University using Pragati Infocom SMS gateway.

Features

  • Secure REST API with API key authentication
  • Bulk SMS support (up to 100 recipients per request)
  • Token caching (6-day cache, persisted to disk, race-condition safe)
  • Pragati error code parsing (detects template mismatches, invalid numbers, etc.)
  • Rate limiting to prevent abuse
  • PM2 ready for production deployment
  • DLT compliant for Indian SMS regulations

Quick Start

cd sms-api
npm install
cp .env.example .env
# Edit .env with your credentials
npm run dev

API Endpoints

Health Check

GET /health

Send SMS

POST /api/sms/send
X-API-Key: your-api-secret-key
Content-Type: application/json

{
  "template": "Your message with {#var#} variables",
  "templateid": "1007384370833937775",
  "recipients": [
    {"phone": "9876543210", "templateVars": ["value1", "value2"]}
  ]
}

Response:

{
  "success": true,
  "results": [
    {"phone": "9876543210", "success": true, "guid": "kpaug..."}
  ]
}

Error codes: 1=Invalid number, 3=Template mismatch, 14=TRAI violation

Token Status

GET /api/sms/token-status
X-API-Key: your-api-secret-key

Deployment

npm install -g pm2
npm run pm2:start
pm2 logs jain-sms-api

For HTTPS setup: See DEPLOYMENT.md

Documentation

License

AGPL-3.0-only

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors