How-to · 3 min read
Receive an OTP in Node.js
A minimal Node.js / TypeScript example for buying a number and reading the verification code, with webhook and polling options.
Install the SDK with npm install @eveses/sdk, then:
import { Eveses } from '@eveses/sdk';
const eveses = new Eveses({ key: process.env.EVESES_KEY! });
const order = await eveses.orders.create({
country: 'ua', mode: 'activation', service: 'telegram',
});
// poll (or register a webhook in production)
const otp = await poll(() =>
eveses.orders.sms(order.order_id).then(o => o.sms?.[0]?.otp));
console.log('code:', otp);
await eveses.orders.finish(order.order_id);
async function poll<T>(fn: () => Promise<T | undefined>, ms = 1500): Promise<T> {
for (;;) { const v = await fn(); if (v) return v; await new Promise(r => setTimeout(r, ms)); }
}
For production, register a webhook so the server pushes the code to you — no polling loop, lower latency.
Ready to build? Create a free Eveses account, top up a wallet, and grab your API key — no KYC. See the API docs or live pricing.
FAQ
▸How do I receive an SMS code in Node.js?
npm install @eveses/sdk, create an order, then poll orders.sms(order_id) or register a webhook.
Related guides