soap-asanak-sms-axios
v1.0.9
Published
A Node.js library for sending SMS via the Asanak SOAP API, fully built on Axios and handling SOAP requests without any SOAP library, purely using raw Axios HTTP XML requests and responses.
Downloads
10
Readme
Soap Asanak SMS Axios JavaScript
SoapAsanakSMSAxiosJS is a Node.js library for sending SMS messages through the Asanak SOAP SMS gateway using Axios.
It sends raw SOAP XML requests and provides full debugging logs, including both the outgoing SOAP request and the incoming SOAP response.
All credentials and configuration values can be easily managed through environment variables.
Table of Contents
Features
- Simple, reusable Node.js library for Asanak SOAP SMS gateway
- Supports credentials from environment variables (
.env) - Logs raw XML request and response for debugging
- Configurable source number and SOAP web service URL
- Built using
axiosfor HTTP requests
Installation
npm install soap-asanak-sms-axiosOr clone the repository:
git clone https://github.com/BaseMax/SoapAsanakSMSAxiosJS.git
cd SoapAsanakSMSAxiosJS
npm installConfiguration
Create a .env file in your project root:
ASANAK_USERNAME=your_username
ASANAK_PASSWORD=your_password
ASANAK_SOURCE_NUMBER=your_number
ASANAK_WEBSERVICE=https://smsapi.asanak.ir/services/CompositeSmsGateway?wsdlThe library will automatically load .env from the current folder or parent directory.
Usage
Using
const AsanakSms = require("soap-asanak-sms-axios");
const sms = new AsanakSms({});Import and Initialize
const AsanakSms = require("./lib/AsanakSms");
const sms = new AsanakSms({});Sending an SMS
(async () => {
try {
const response = await sms.send("989121111010", "سلام - این یک پیام تست است");
console.log("Response:", response);
} catch (err) {
console.error("Failed to send SMS:", err.message);
}
})();Notes:
send(destAddress, message)sends a single SMS.- Logs will display raw request XML, response headers, and raw response XML.
Project Structure
SoapAsanakSMSAxiosJS/
├── lib/
│ └── AsanakSms.js # Main library
├── tests/ # Test scripts
├── .env # Environment variables
├── package.json
└── README.mdLicense
This project is licensed under the MIT License.
Copyright © 2025 Seyyed Ali Mohammadiyeh (Max Base)
