JSPM

tempnumber-client

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 46
  • Score
    100M100P100Q52138F
  • License MIT

temp-number.org SMS Typescript client

Package Exports

  • tempnumber-client
  • tempnumber-client/build
  • tempnumber-client/package.json

Readme

Num SDK

TypeScript SDK for temp-number.org/business mass phone activation service

Install

Install the package using npm

npm install tempnumber-client

Usage/Examples

import NumSdk, * as sdk from 'tempnumber-client'

const api = new NumSdk({ apiKey: 'YOUR_API_KEY', baseUrl: 'https://business.temp-number.org/v1' })(async () => {
  const balance = await this.api.user.getBalance()
  console.log(`My balance is ${balance.total}`)
})()

/* Getting a number to activate Twitter service in US */
api.activation
  .newActivation({ service_id: 527, country_id: 'us' })
  .then(async (activation: NumSdk.newActivationResponseType) => {
    // Send message to number activation.phone

    // Receive sms
    const activationStatus = await api.activation.getActivationState(activation.id)
    // Use received sms message and OTP code parsed from it
    // activationStatus.sms_code is a parsed activation code from sms message
    // activationStatus.sms_text is a full sms message
  })