node-five-sim
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

Five Sim API for NodeJs - 5sim.net

A complete API wrapper for 5sim.net

Installation

npm i @learxd/node-five-sim

or

npm i https://github.com/LearXD/five-sim

Usage (complex)

const { FiveSim } = require('node-five-sim');

const youAsyncFunction = async (country, product) => {
  const fiveSim = new FiveSim({ token: 'YOUR_TOKEN' })
  const services = await fiveSim.getPricesByCountryAndProduct()

  // random price services  
  const [operator, data] = Object.entries(services[country][product])[0]

  // buy number
  const order = await fiveSim.purchase(country, product, operator)

  // wait code
  const sms = await fiveSim.waitForCode(order.id)
  console.log('Received the code: ' + sms.code)

  // finish order
  fiveSim.finishOrder(order.id)
}

youAsyncFunction('russia', 'microsoft')

Usage (simple)

const { FiveSim } = require('node-five-sim');

const youAsyncFunction = async (country, product) => {
  const fiveSim = new FiveSim({ token: 'YOUR_TOKEN' })

  // auto select cheapest and purchase
  const order = await fiveSim.purchaseCheapest(country, product)

  // wait code
  const sms = await fiveSim.waitForCode(order.id)
  console.log('Received the code: ' + sms.code)

  // finish order
  await fiveSim.finishOrder(order.id)
}

youAsyncFunction('russia', 'microsoft')

Credits

Contributing

  • Feel free to open issues and pull requests.

Package Sidebar

Install

npm i node-five-sim

Weekly Downloads

6

Version

1.2.2

License

ISC

Unpacked Size

31.7 kB

Total Files

15

Last publish

Collaborators

  • learxd