smspanel

[SmsPanel (https://www.csms.ir/) implementation in Node.JS * Easy to Use * Promises/A+ Compatible

Usage no npm install needed!

<script type="module">
  import smspanel from 'https://cdn.skypack.dev/smspanel';
</script>

README

SmsPanel

[SmsPanel (https://www.csms.ir/) implementation in Node.JS

  • Easy to Use
  • Promises/A+ Compatible

🕹 Usage

Install the package from npm and require it in your Node project:

npm install smspanel


```javascript
const smspanelcheckout = require('smspanel');
// or
import smspanelcheckout from 'smspanel';

Then create an instance:

/**
 * Create SmsPanel
 * @param {String} `*****-****-****-***-*******` [AccessHash] =>Get From Csms.ir
 */
const SmsPanel = smspanelcheckout.create("*****-****-****-***-*******");

📢 API

★ Get JWT Token:

/**
 * jwt [module]
 * @return {Json} URL [Result]
 */
SmsPanel.JwtToken({
        UserName:"saeed",
        Password:"123456"
    })
.then(response => {
  if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ Calculate Send Sms Price:

SmsPanel.SendSmsPrice({
        Token:Token,
         Message:"سلام",
        SmsNumber:"3000*********",
        ReceiverNumber:['********'],
        Checkblacklist:0
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ Fast Send Sms :

SmsPanel.FastSendSms({
        Token:Token,
        Message:"سلام",
        SmsNumber:"3000*********",
        ReceiverNumber:['911*******'],
        Source:1
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ Send Sms :

SmsPanel.SendSms({
        Token:Token,
        Message:"سلام",
        SmsNumber:"3000*********",
        ReceiverNumber:['911*******'],
        Source:1
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ Periodic Send Sms :

SmsPanel.PeriodicSendSms({
        Token:Token,
        Message:"سلام",
        SmsNumber:"3000*********",
        ReceiverNumber:['911*******'],
        StartDate:'3/3/2021 12:55:00',
        EndDate:'3/10/2021 12:55:00',
        Type:1, 
        PeriodCount:3, 
        Source: 1,
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ One To One Send Sms Price:

SmsPanel.OneToOneSendSmsPrice({
        Token:Token,
        Message:"سلام",
        SmsNumber:"3000*********",
        MessageNumberList:[{
            Message:"2سلام",
            ReceiveNumber:"911*******"
        }]
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ One To One Send Sms :

SmsPanel.OneToOneSendSms({
        Token:Token,
        Message:"سلام",
        SmsNumber:"3000*********",
        MessageNumberList:[{
            Message:"2سلام",
            ReceiveNumber:"911*******"
        }],
        Checkblacklist:1
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ OTP Verify :

SmsPanel.OTPVerify({
        Token:Token,
        phoneNumber:"0911*******",
        Code:"3000*********",
        OTPName:"1"
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

★ Register New User :

SmsPanel.RegisterNewUser({
        Token:Token,
        MobileNumber:"0911*******",
        IsReal:1,
        UserName:"saeed",
        CompanyName:"",
        FirstName:"saeed",
        LastName:"b",
        Reg:""
    }).then(response => {
   if (response.status === 200) {
    console.log(response);
  }
}).catch(err => {
  console.error(err);
});

🔆 To-Do

  • Add Extra mode for API.
  • Promises/A+
  • Send Request axios.

👋 Contribution

Contributions are welcome. Please submit PRs or just file an issue if you see something broken or in need of improving.

🍀 License

This software is released under the MIT License.

The MIT License (MIT)

Copyright (c) 2021-2022 Saeed Bahor

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.