npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wenova-link

v2.0.1

Published

WENOVA Link SDK — SMS/OTP, address, currency format, and Lao time plugins

Readme

wenova-link

All-in-one SDK for WENOVA Link — SMS/OTP, Lao address, currency format, and Lao time plugins.

For single-feature packages, see also wenova-sms-otp and wenova-address.

Installation

npm i wenova-link

Usage

const {
  sendOtp,
  getProvinces,
  getProvinceById,
  getDistrictsByProvince,
  getDistrictById,
  getVillagesByDistrict,
  getVillageById,
  currencyFormat,
  currencyAllAmount,
  currencyList,
  laoTimeFormat,
  laoTimeFormatByYear,
  laoTimeFormatByMonthIndex,
  laoTimeFormatByMonthName,
} = require('wenova-link');

SMS / OTP

Use either API Token or Script ID (at least one required).

await sendOtp({
  header: 'WNV-OTP',
  phoneNumber: '2012345678',
  message: 'Your OTP is: 123456',
  token: 'your-token',
  usePackage: true,
});

Address (plugin key required)

const pluginKey = 'your-plugin-key';

const provinces = await getProvinces({ pluginKey, kw: 'vien' });
const districts = await getDistrictsByProvince(1, { pluginKey });
const villages = await getVillagesByDistrict(1, { pluginKey });

Currency format (plugin key required)

await currencyFormat({ code: 'LAK', amount: '1000', key: 'your-plugin-key' });
await currencyAllAmount({ amount: '5000', key: 'your-plugin-key' });
await currencyList({ code: 'LAK', field: 'price', items: [...], key: 'your-plugin-key' });

Lao time (plugin key required)

await laoTimeFormat({ data: '18-06-2026', key: 'your-plugin-key' });
await laoTimeFormatByYear({ year: '2026', key: 'your-plugin-key' });
await laoTimeFormatByMonthIndex({ index: '01', key: 'your-plugin-key' });
await laoTimeFormatByMonthName({ name: 'January', key: 'your-plugin-key' });

API

sendOtp(data)

Sends SMS/OTP via Wenova API (POST /sms/package).

  • data.header (string): SMS header (e.g. WNV-OTP)
  • data.phoneNumber (string): 10 digits starting with 20
  • data.message (string): Message content
  • data.token (string, optional): API token
  • data.scriptId (number, optional): Script ID
  • data.usePackage (boolean): true = deduct from SMS package
  • data.baseUrl (string, optional): API base URL

Address

  • getProvinces({ pluginKey, kw?, baseUrl?, lang? })
  • getProvinceById(id, { pluginKey, baseUrl?, lang? })
  • getDistrictsByProvince(provinceId, { pluginKey, kw?, baseUrl?, lang? })
  • getDistrictById(id, { pluginKey, baseUrl?, lang? })
  • getVillagesByDistrict(districtId, { pluginKey, kw?, baseUrl?, lang? })
  • getVillageById(id, { pluginKey, baseUrl?, lang? })

Currency

  • currencyFormat({ code, amount, key })
  • currencyAllAmount({ amount, key })
  • currencyList({ code, field, items, key })

For LAK, formatted is Lao Kip text:

{
  "raw": 1000,
  "formatted": "ໜຶ່ງພັນກີບຖ້ວນ",
  "code": "LAK",
  "symbol": "₭"
}

Lao time

  • laoTimeFormat({ data, key })
  • laoTimeFormatByYear({ year, key })
  • laoTimeFormatByMonthIndex({ index, key })
  • laoTimeFormatByMonthName({ name, key })

All functions return a Promise with the API response.

Throws: WenovaApiError when validation fails or the API returns a non-success response.

Error handling

Failed API calls throw WenovaApiError with structured fields parsed from the Wenova API body.

const { sendOtp, WenovaApiError } = require('wenova-link');

try {
  await sendOtp({
    header: 'WNV-OTP',
    phoneNumber: '2012345678',
    message: 'Your OTP is: 123456',
    token: 'invalid-token',
    usePackage: true,
  });
} catch (err) {
  if (err instanceof WenovaApiError) {
    console.error(err.message);    // e.g. "[30307] SMS API token not found"
    console.error(err.code);       // 30307 (Wenova 5-digit business code)
    console.error(err.statusCode); // HTTP status (e.g. 404)
    console.error(err.path);       // API path
    console.error(err.method);     // HTTP method
    console.error(err.response);   // Raw error JSON from API
  }
}

Success response shape

{
  "success": true,
  "message": "Request successful",
  "data": { },
  "timestamp": "2026-06-18T12:00:00.000Z",
  "statusCode": 200,
  "path": "/sms/package",
  "method": "POST"
}

Error response shape

{
  "statusCode": 400,
  "timestamp": "2026-06-18T12:00:00.000Z",
  "path": "/sms/package",
  "method": "POST",
  "message": "Either token or scriptId is required",
  "code": 30101
}

code is the Wenova 5-digit business id (not HTTP status). Format: XX (service) + Y (category) + ZZ (sequence).

Common error codes

Wenova code format: XX (service) + Y (category) + ZZ (sequence).

| Code | Message | |------|---------| | SMS (30xxx) | | | 30101 | Either token or scriptId is required | | 30102 | Links are not allowed in SMS messages | | 30105 | SMS package quota is insufficient | | 30106 | Wallet balance is insufficient for SMS segments | | 30107 | User must be verified before sending SMS | | 30108 | User account is not active | | 30302 | Wallet not found for user | | 30303 | SMS package not found | | 30307 | SMS API token not found | | 30308 | SMS scriptId not found | | 30501 | SMS rate limit exceeded | | 30901 | SMS gateway returned an error | | Address (60xxx) | | | 60101 | Plugin key (key) query parameter is required | | 60102 | Plugin key is valid but not enabled for address API | | 60103 | User plugin subscription is not active | | 60104 | Invalid province, district, or village id in URL | | 60301 | Province not found | | 60302 | District not found | | 60303 | Village not found | | Currency format (60xxx) | | | 60101 | Plugin key (key) is required | | 60102 | Plugin key is valid but not enabled for currency API | | 60103 | User plugin subscription is not active | | 60304 | Currency format with code not found (e.g. invalid ISO code) | | 90101 | Request validation failed (missing code, amount, field, or items) | | Lao time (60xxx) | | | 60101 | Plugin key (key) is required | | 60102 | Plugin key is valid but not enabled for lao-time API | | 60103 | User plugin subscription is not active | | 60105 | Invalid date format (expected DD-MM-YYYY) | | 60106 | Invalid month index (01–12) or month name | | Common / system (90xxx) | | | 90101 | Request validation failed | | 30501 | Rate limit exceeded | | 90901 | Internal server error |

Plugin endpoints (address, currency, lao-time) share the 60xxx range. Use 6010160103 for key/auth issues and 603xx for resource-not-found cases.

Exported error helpers

  • WenovaApiError — error class with code, statusCode, path, method, response
  • getWenovaErrorCode(data) — extract 5-digit code from API body
  • extractMessageText(data) — extract human-readable message
  • formatErrorMessage(data) — message with [code] prefix when available