GetSMS

new GetSMS(options) → {GetSMS}

GetSMS class constructor
Parameters:
NameTypeDescription
optionsInitPropertiesOptions object
Throws:
Error
Returns:
Type: 
GetSMS

Methods

(async) getAdditionalService(id, service) → {Promise.<additionalServiceResponse>}

Method for getting additional service for numbers with forward (only for smsactivate)
Parameters:
NameTypeDescription
idstringMobile number ID
servicestringService code name
Throws:
Returns:
Type: 
Promise.<additionalServiceResponse>

(async) getBalance() → {Promise.<BalanceObject>}

Method for getting account balance
Throws:
Returns:
Type: 
Promise.<BalanceObject>

(async) getCode(id, timeoutopt) → {Promise.<getCodeResponse>}

Method which polling with getStatus method and returns new status when it's changes
Parameters:
NameTypeAttributesDefaultDescription
idstring | numberMobile number ID
timeoutnumber<optional>
0Timeout, after reached - forcefully stop and throw `TimeoutError`, pass 0 to disable
Throws:
Returns:
Type: 
Promise.<getCodeResponse>
Example
const { id, number } = await sms.getNumber('vk', 'mts', 0)
console.log('Number ID:', id);
console.log('Number:', number);
await sms.setStatus(1, id);
// Wait for code
const { code } = await sms.getCode(id)
console.log('Code:', code)
await sms.setStatus(1, id) //Accept, end

(async) getCountries() → {Promise.<object>}

Method for getting countries list (only for smsactivate)
Throws:
Returns:
Type: 
Promise.<object>

(async) getCurrentActivations() → {Promise.<object>}

Unofficial / hidden method for getting list of current activations (only for smshub)
Throws:
Returns:
Type: 
Promise.<object>
Example
Answer example:
// Success request:

{
  status: 'success',
  array: [
    {
      id: '1231231231',
      activationId: '1231231231',
      apiKeyId: '12345',
      phone: '79538364598',
      status: '2',
      moreCodes: '',
      createDate: 1654770955,
      receiveSmsDate: -62169993017,
      finishDate: '0000-00-00 00:00:00',
      activation: [Object],
      code: '<img src="/assets/ico/loading.gif" width="50px"></img>',
      countryCode: '7',
      countryName: 'Россия',
      timer: 1200
    }
  ],
  time: 1654770985
}

// No activations:
{ status: 'fail', msg: 'no_activations' }

(async) getFullSms(id) → {Promise.<fullSMSTextResponse>}

Method for getting full sms text (only for smsactivate)
Parameters:
NameTypeDescription
idstring | numberMobile number ID
Throws:
Returns:
Type: 
Promise.<fullSMSTextResponse>

(async) getListOfCountriesAndOperators() → {Promise.<object>}

Unofficial / hidden method for getting list of countries & operators (only for smshub)
Throws:
Returns:
Type: 
Promise.<object>
Example
Answer example:
{
    status: "success",
    services: [{
        lb: "Mailru Group",
        vk: "Вконтакте",
        ok: "Ok.ru",
        // ...
        ot: "Любой другой"
     },
     // ...
    ],
    data: [{
        name: "Индонезия",
        id: "6",
        operators: ["any", "axis", "indosat", "smartfren", "telkomsel", "three"]
    }],
    currentCountry: "0",
    currentOperator: "any"
}

(async) getMultiServiceNumber(service, operator, country, forwardopt, refopt) → {Promise.<object>}

Method for getting number for using with several services (only for smsactivate)
Parameters:
NameTypeAttributesDescription
servicearray | stringArray of services names
operatorarray | stringArray of operators names
countrystring | numberCountry ID
forwardArray.<(string|number)> | string<optional>
Number forward, must have values 1 or 0 *
refstring<optional>
Referral identifier
Throws:
Returns:
Type: 
Promise.<object>
Examples
.getMultiServiceNumber('ok,vk,vi,av', 'mts', 0, '0,1,0,0')
.getMultiServiceNumber(['ok','vk','vi','av'], 'mts', 0, [0, 1, 0, 0])

(async) getNumber(service, operatoropt, countryopt, forwardopt, phoneExceptionopt, refopt) → {Promise.<object>}

Method for getting new number Arguments with * available only for smsactivate
Parameters:
NameTypeAttributesDescription
servicestringService code name
operatorstring<optional>
Mobile operator code name
countrystring | number<optional>
Country ID
forwardstring | number<optional>
Number forward, must be `1` or `0` *
phoneExceptionstring<optional>
Prefixes for excepting mobile numbers separated by comma *
refstring<optional>
Referral identifier *
Throws:
Returns:
Type: 
Promise.<object>

(async) getNumbersStatus(countryopt, operatoropt) → {object}

Method for getting number status
Parameters:
NameTypeAttributesDescription
countrystring | number<optional>
Country ID
operatorstring<optional>
Mobile operator code name
Throws:
Returns:
Type: 
object

(async) getPrices(countryopt, service) → {Promise.<object>}

Method for getting numbers prices
Parameters:
NameTypeAttributesDescription
countrystring | number<optional>
Country ID
servicestringService code name
Throws:
Returns:
Type: 
Promise.<object>

(async) getQiwiRequisites() → {Promise.<object>}

Method for getting Qiwi payment requisites (only for smsactivate)
Throws:
Returns:
Type: 
Promise.<object>

(async) getStatus(id) → {Promise.<object>}

Method for getting number status
Parameters:
NameTypeDescription
idstring | numberMobile number ID
Throws:
Returns:
Type: 
Promise.<object>

(async) setMaxPrice(service, maxPrice, random, country) → {Promise}

Unofficial / hidden method for changing default number settings (only for smshub) Change max price of mobile number for country id, enable / disable random

WARNING: I don't know why, but really values changed only after ~30 seconds, maybe it's cached on smshub server
Parameters:
NameTypeDefaultDescription
servicestringService code name
maxPricestring | numberMax buy price
randombooleantrueEnable random number
countrystring | numberCountry ID
Throws:
Returns:
Type: 
Promise

(async) setStatus(status, id) → {Promise.<object>}

Method for set number status
Parameters:
NameTypeDescription
statusstring | numberNew mobile number status
idstring | numberMobile number ID
Throws:
Returns:
Type: 
Promise.<object>