Usage
Create a client
import PayamSMS from "payamsms-sdk";
const sms = new PayamSMS(
"organization", // organization id / name
"username",
"password",
"3000xxxxxxx", // sender line
);
Requests go to
https://new.payamsms.com/services/rest/index.php
with organization, username, and password on each call.
Balance
Send
Pass an array of objects (recipient + body). The SDK attaches your sender line automatically.
const messages = [
{
recipient: "0912xxxxxxx",
body: "Hello from PayamSMS",
},
{
recipient: "0935xxxxxxx",
body: "Second message",
},
];
const result = await sms.send(messages);
console.log(result);
Successful items look like:
Failed items use code: 500 and a mapped error message.
Phone numbers are validated with a simple Iranian mobile pattern (09… / +98…).
Notes
- Methods are async — use
awaitor.then(). - Receive/inbox is not implemented yet in this SDK.