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

@emito/provider-smsapi

v0.1.0

Published

SMSAPI SMS provider plugin for Emito.

Downloads

169

Readme

@emito/provider-smsapi

SMSAPI SMS provider adapter for Emito.

License Types

TypeScript Zod

What it is

@emito/provider-smsapi is the SMS delivery adapter that lets Emito send text messages through SMSAPI. It talks to the SMSAPI REST endpoint directly via fetch (no SDK dependency) and exposes a ProviderPlugin that the Emito core engine can register on the sms channel — handling message dispatch, validating credentials at construction time, and translating SMSAPI's error responses into Emito's typed EmitoError codes so the engine can decide what to retry and what to suppress.

Emito is provider-agnostic: the core engine speaks ProviderPlugin, and each provider package teaches it how to talk to one delivery service. This package is the SMSAPI implementation for SMS.

Install

Emito is developed as a pnpm workspace; the @emito/* packages are consumed from within the monorepo. Add the provider to a workspace package as a workspace dependency:

// package.json
"dependencies": {
  "@emito/provider-smsapi": "workspace:*"
}

Standalone npm publishing of the @emito/* scope is planned but not yet available — install from the workspace for now.

The package has no third-party SDK dependency — it uses the global fetch — and is built to run alongside @emito/core, which consumes the provider it produces.

Usage

Create the provider with your SMSAPI credentials and register it on the sms channel when you build your Emito instance:

import { createEmito } from "@emito/core";
import { createSmsapiProvider } from "@emito/provider-smsapi";

const smsapi = createSmsapiProvider({
  accessToken: process.env.SMSAPI_ACCESS_TOKEN!, // OAuth token from smsapi.pl
  from: process.env.SMSAPI_FROM!,                // approved sender name
  // endpoint: "https://api.smsapi.pl/sms.do",   // optional override (default)
});

const emito = createEmito({
  // ...database, redis, repositories, events...
  channels: {
    sms: {
      providers: [smsapi],
    },
  },
});

createSmsapiProvider validates its config eagerly: if accessToken or from is missing, it throws an EmitoError with code CONFIG_INVALID before any message is sent. The recipient's + prefix is stripped automatically before the request is sent.

API surface

| Export | Kind | Description | | --- | --- | --- | | createSmsapiProvider(config) | function | Builds a ProviderPlugin for the sms channel. Validates config and returns a plugin with deliver and healthCheck. | | SmsapiProviderConfig | type | Shape of the provider config: accessToken and from (required, non-empty strings) plus optional endpoint. | | SmsapiProviderConfigSchema | Zod schema | The zod schema used to validate SmsapiProviderConfig, exported for reuse in your own config validation. |

The returned plugin reports name: "smsapi" and channel: "sms".

Error mapping

SMSAPI error responses raised during deliver are translated into Emito's typed EmitoError codes so the engine can apply the right retry and suppression behavior:

| Condition | Emito error code | Retryable | | --- | --- | --- | | HTTP 429 | RATE_LIMITED | yes | | Authentication failure (101, 102) | CONFIG_INVALID | no | | Invalid recipient number (13, 14) | DELIVERY_INVALID_ADDRESS | no | | Transient SMSAPI error (8, 201) or HTTP 5xx | PROVIDER_UNAVAILABLE | yes | | Any other SMSAPI error | DELIVERY_REJECTED | no |

Requests carry a 10 second deadline; exceeding it raises a retryable PROVIDER_TIMEOUT. Other network failures become a retryable PROVIDER_UNAVAILABLE.

Part of Emito

@emito/provider-smsapi is one package in the Emito monorepo — self-hosted, provider-agnostic notification infrastructure for Node.js and TypeScript.

License

MIT — part of the Emito project.