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

alphasms-client

v0.3.1

Published

Lightweight TypeScript client for AlphaSMS JSON API with first-class support for Node.js and NestJS backends.

Downloads

33

Readme

AlphaSMS Client

npm version TypeScript node stars

Lightweight, strongly-typed TypeScript client for the AlphaSMS JSON API.

Designed for Node.js services and NestJS backends.


✨ Features

  • TypeScript support
  • Promise-based API
  • Strongly-typed responses
  • Built-in timeout handling
  • Structured error handling
  • ESM + CJS support

📦 Installation

npm install alphasms-client

Or with scope:

npm install @leadbox/alphasms-client

🔑 Usage

Basic Example (Node.js)

import { AlphaSmsClient } from 'alphasms-client'

const client = new AlphaSmsClient({
  auth: process.env.ALPHASMS_AUTH
})

const balance = await client.balance()

console.log(balance.amount, balance.currency)

Send SMS

const result = await client.sendSms({
  id: 100500,
  phone: 380971234567,
  sms_signature: 'SMSTest',
  sms_message: 'Hello from AlphaSMS',
  sms_lifetime: 172800,
  short_link: true,
  unsubscribe_link: true,
  hook: 'https://example.org/webhook/url.php'
})

console.log(result.msg_id)

Check message status

const st = await client.getStatus(100500)
console.log(st.type, st.status)

With dotenv

npm install dotenv
import 'dotenv/config'
import { AlphaSmsClient } from 'alphasms-client'

const client = new AlphaSmsClient({
  auth: process.env.ALPHASMS_AUTH
})

const balance = await client.balance()
console.log(balance)

🏗 NestJS Example

import { Injectable } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { AlphaSmsClient } from 'alphasms-client'

@Injectable()
export class AlphaSmsService {
  private client: AlphaSmsClient

  constructor(private config: ConfigService) {
    this.client = new AlphaSmsClient({
      auth: this.config.getOrThrow<string>('ALPHASMS_AUTH')
    })
  }

  balance() {
    return this.client.balance()
  }
}

📘 API

new AlphaSmsClient(options)

| Option | Type | Required | Default | | --------- | ------ | -------- | -------------------------------- | | auth | string | Yes | – | | baseUrl | string | No | https://alphasms.ua/api/json.php | | timeoutMs | number | No | 15000 |


client.balance()

Returns:

{
  amount: number
  currency: string
}

❗ Error Handling

All errors throw AlphaSmsError.

import { AlphaSmsError } from 'alphasms-client'

try {
  await client.balance()
} catch (error) {
  if (error instanceof AlphaSmsError) {
    console.error(error.code)
    console.error(error.message)
  }
}

Error codes:

  • CONFIG
  • HTTP_ERROR
  • API_ERROR
  • API_ITEM_ERROR
  • BAD_RESPONSE
  • TIMEOUT
  • UNKNOWN

🔒 Security

Do not expose your API auth key in frontend applications.

Use this client only in backend services (Node.js, NestJS, etc).


🧪 Development

npm install
npm run build

📜 License

MIT

📘 Official Documentation

AlphaSMS JSON API: https://docs.alphasms.ua/api/json/