Skip to content

Siddhart/SMSPool.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSPool.js

Unofficial API wrapper for SMSPool.net. With this wrapper you are able to call all endpoints with functions.
Join the SMSPool.net Discord server.

Table Of Contents


SMSpool.net API Documentation

Checkout the official API documentation here https://www.smspool.net/article/how-to-use-the-smspool-api.

Getting Started

To get started you have to install the smspool npm package

npm install smspool.js

After that we can import smspool.js

const smspool = require("./index");
smspool.client("<api-key>");

(async function() {
    let result = await smspool.getBalance()
    console.log(result);
}())

Main Documentation

client()

To assign an api key to the client use the client() method.

smspool.client("<your-api-key>");

Get your api key here


getCountries()

Returns a list of Countries.

Response:

[
  {
    "ID": "1",
    "name": "United States",
    "region": "Americas"
  },
  {
    "ID": "2",
    "name": "United Kingdom",
    "region": "Europe"
  },
  {
    "ID": "3",
    "name": "Netherlands",
    "region": "Europe"
  },
]

Checkout the official documentation


getServices()

Returns a list of all services.

Response:

[
  {
    "ID": "1",
    "name": "service1"
  },
  {
    "ID": "2",
    "name": "service2"
  },
  {
    "ID": "3",
    "name": "service3"
  },
]

Checkout the official documentation


getBalance()

Returns the balance of the user.
API Key required!

Response:

{
  "balance": "1.00"
}

Checkout the official documentation


getOrderHistory()

Returns a list of all orders.
API Key required!

getActiveOrders()

Returns a list of all active orders.
API Key required!

Response:

{
   "timestamp":"2022-05-24 21:20:07",
   "order_code":"ABCDEFGH",
   "phonenumber":"123456789",
   "code":"0",
   "full_code":"0",
   "short_name":"US",
   "service":"Service",
   "status":"pending",
   "expiry":"1653420607"
}

Checkout the official documentation


SMS Documentation

getSMSServicePrice(country, service)

Returns the price of a specific service.
API Key required!

country = The country code/ID that you can retrieve from the country endpoint.
service = The service ID/name that you can retrieve from the service endpoint.

Response:

{
   "timestamp":"2022-05-24 21:20:07",
   "order_code":"ABCDEFGH",
   "phonenumber":"123456789",
   "code":"0",
   "full_code":"0",
   "short_name":"US",
   "service":"Service",
   "status":"pending",
   "expiry":"1653420607"
}

Checkout the official documentation


purchaseSMS(country, service, pool(not required))

Order a number.
API Key required!

country = The country code/ID that you can retrieve from the country endpoint.
service = The service ID/name that you can retrieve from the service endpoint.
pool = The pool you'd like to order from is not required, in case it's empty it'll automatically select a suitable pool. Pools can be selected by number or by name (for example Alpha).

Response:

{
   "success":1,
   "number":"123456789",
   "order_id":"ABCDEFG",
   "country":"United States",
   "service":"Service",
   "pool":5,
   "expires_in":599,
   "message":""
}

Checkout the official documentation


checkSMS(orderID)

View sms order details.
API Key required!

orderID = The order_id you received from the Order SMS endpoint.

Response:

{
  "status": 3,
  "sms": "00000",
  "full_sms": "full SMS"
}

Checkout the official documentation


resendSMS(orderID)

Resend code to number.
API Key required!

orderID = The order_id you received from the Order SMS endpoint.

Response:

{
  "success":1,
  "message":"Number has been requested again",
  "resend":0
}

Checkout the official documentation


cancelSMS(orderID)

Cancel an SMS order.
API Key required!

orderID = The order_id you received from the Order SMS endpoint.

Response:

{
  "success": 1
}

Checkout the official documentation


archiveSMSOrders(orderID)

Archive all SMS orders. API Key required!

orderID = The order_id you received from the Order SMS endpoint.

Response:

{
   "success":1,
   "message":"All your inactive orders have been archived."
}

Checkout the official documentation


Rentals Documentation

getRentals(type)

Archive all SMS orders.

type = true/false
true = Extendable
false = one-time

Response:

{
   "0":{
      "name":"United States",
      "region":"Americas",
      "pricing":"{\"7\":18,\"14\":25,\"30\":30}"
   }
}

Checkout the official documentation


purchaseRental(rentalID, days, service_id)

Purchase a rental.
API Key required!

rentalID = The rental ID was retrieved from the "Retrieve all rentals" endpoint.
days = The number of days you'd like to rent for.
service_id = Specify a service ID to only purchase a line for that service and get 50% off. Only works for US extendable rentals.

Response:

{
   "success":1,
   "message":"",
   "phonenumber":"123456789",
   "days":30,
   "rental_code":"ABCDEFG",
   "expiry":"1653758381"
}

Checkout the official documentation


getRentalMessage(rental_code)

Retrieve rental message.
API Key required!

rental_code = The retrieved rental code from the Order rental endpoint.

Response:

{
   "success":1,
   "messages":{
      "0":{
         "ID":6,
         "sender":null,
         "message":"Message 1",
         "timestamp":"11 May 2022 18:39:54"
      },
      "1":{
         "ID":6,
         "sender":null,
         "message":"Message 2",
         "timestamp":"11 May 2022 01:11:35"
      }
   },
   "source":"6"
}

Checkout the official documentation


getRentalStatus(rental_code)

Get the status of a rental.
API Key required!

rental_code = The retrieved rental code from the "Order rental" endpoint.

Response:

{
   "success":1,
   "status":{
      "expiry":1654495533,
      "available":1,
      "phonenumber":"123456789",
      "activeFor":90
   }
}

Checkout the official documentation


refundRental(rental_code)

Refund a rental.
API Key required!

rental_code = The retrieved rental code from the Order rental endpoint.

Response:

{
   "success":1,
   "message":"Your rental has been refunded!"
}

Checkout the official documentation


extendRental(rental_code, days)

Refund a rental.
API Key required!

rental_code = The retrieved rental code from the Order rental endpoint.
days = The amount of days you'd like to extend it with.

Response:

{
   "success":1,
   "message":"Your rental has been succesfully extended!"
}

Checkout the official documentation

How can I contribute to this project?

Before you start working on a feature or fix open a issue. After that fork the project and change anything you want. I will review the pull request and merge it to the main branch.

About

Unofficial API wrapper for SMSPool.net.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published