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-twilio

v0.1.0

Published

Twilio SMS provider plugin for Emito.

Readme

@emito/provider-twilio

Twilio SMS provider adapter for Emito.

License Types

TypeScript Zod

What it is

@emito/provider-twilio is the SMS delivery adapter that lets Emito send text messages through Twilio. It wraps the official twilio SDK in a ProviderPlugin that the Emito core engine can register on the sms channel — handling message dispatch, validating credentials at construction time, and translating Twilio's REST errors 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 Twilio 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-twilio": "workspace:*"
}

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

The package depends on the twilio SDK (bundled as a dependency) and is built to run alongside @emito/core, which consumes the provider it produces.

Usage

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

import { createEmito } from "@emito/core";
import { createTwilioProvider } from "@emito/provider-twilio";

const twilio = createTwilioProvider({
  accountSid: process.env.TWILIO_ACCOUNT_SID!,
  authToken: process.env.TWILIO_AUTH_TOKEN!,
  fromNumber: process.env.TWILIO_FROM_NUMBER!, // e.g. "+15551234567"
});

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

createTwilioProvider validates its config eagerly: if accountSid, authToken, or fromNumber is missing, it throws an EmitoError with code CONFIG_INVALID before any message is sent.

API surface

| Export | Kind | Description | | --- | --- | --- | | createTwilioProvider(config) | function | Builds a ProviderPlugin for the sms channel. Validates config, instantiates the Twilio client, and returns a plugin with deliver and healthCheck. | | TwilioProviderConfig | type | Shape of the provider config: accountSid, authToken, fromNumber (all required, non-empty strings). | | TwilioProviderConfigSchema | Zod schema | The zod schema used to validate TwilioProviderConfig, exported for reuse in your own config validation. |

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

Error mapping

Twilio REST errors 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 | | Invalid to/from number (21211, 21614) | DELIVERY_INVALID_ADDRESS | no | | Unsubscribed recipient (21610) | DELIVERY_SPAM_COMPLAINT | no | | Hard bounce (30005, 30006) | DELIVERY_HARD_BOUNCE | no | | Destination unreachable (30003) | PROVIDER_UNAVAILABLE | yes | | Authentication failure (20003) | CONFIG_INVALID | no | | HTTP 5xx | PROVIDER_UNAVAILABLE | yes | | Any other Twilio error | DELIVERY_REJECTED | no |

Part of Emito

@emito/provider-twilio 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.