online-sim
v0.0.8
Published
online sim api wrapper
Downloads
580
Readme
Online sim API wrapper
Install
npm i online-sim
Examples
import onlinesim from 'online-sim';
const { OnlineSim, ServiceType, CountryCode } = onlinesim;
const sim = new OnlineSim(
{
apiKey: 'YOUR_API_KEY',
devId: 'YOUR_DEV_ID'
},
'YOUR_PROXY_URL'
);
// Setters
// sim.apiKey = 'YOUR_API_KEY';
// sim.proxy = 'YOUR_PROXY_URL';
(async () => {
// Get number
const { number, tzid } = await sim.getNumber(
ServiceType.EBAY,
CountryCode.ESTONIA
);
console.log(`TzId: ${tzid}`);
console.log(`Number: ${number.value}`);
console.log(`Formatted number: ${number.withoutCountryCode()}`);
await sim.waitSmsCodeNumber({
tzId: tzid,
onSmsCode: code => {
if (!code) {
console.log('sms code not exists');
} else {
console.log(`Sms code is ${code}`);
}
}
// Optional
// checkCount: 10,
// interval: 3000
});
})();