{"_id":"@emito/provider-twilio","name":"@emito/provider-twilio","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@emito/provider-twilio","version":"0.1.0","license":"MIT","description":"Twilio SMS provider plugin for Emito.","keywords":["emito","notifications","notification-infrastructure","self-hosted","twilio","sms","provider","plugin"],"repository":{"type":"git","url":"git+https://github.com/emito-pro/emito.git","directory":"packages/provider-twilio"},"homepage":"https://github.com/emito-pro/emito/tree/main/packages/provider-twilio#readme","bugs":{"url":"https://github.com/emito-pro/emito/issues"},"author":{"name":"SFER LABS LLC"},"engines":{"node":">=22"},"publishConfig":{"access":"public"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"twilio":"^5.0.0","zod":"^3.24.0","@emito/provider-kit":"0.1.0","@emito/types":"0.1.0"},"devDependencies":{"@vitest/coverage-v8":"^3.0.0","typescript":"^5.8.0","vitest":"^3.0.0"},"scripts":{"build":"tsc --project tsconfig.build.json","test":"vitest run --coverage","check":"tsc --noEmit","lint":"biome check src/"},"_id":"@emito/provider-twilio@0.1.0","_integrity":"sha512-XI+A0SY6QDVvYCj//SMHMh8UDrGHV6RFV3JG5wPOLMsHMFwbSSB7hI5l/LZdbjrolHtmZNcZ4xEI57AAao/R4g==","_resolved":"/tmp/93124ce5db1c6172c796509477b82069/emito-provider-twilio-0.1.0.tgz","_from":"file:emito-provider-twilio-0.1.0.tgz","_nodeVersion":"22.23.2","_npmVersion":"10.9.8","dist":{"integrity":"sha512-XI+A0SY6QDVvYCj//SMHMh8UDrGHV6RFV3JG5wPOLMsHMFwbSSB7hI5l/LZdbjrolHtmZNcZ4xEI57AAao/R4g==","shasum":"83606ab30022e5cddc3de5172871b6e3b7fdee95","tarball":"https://registry.npmjs.org/@emito/provider-twilio/-/provider-twilio-0.1.0.tgz","fileCount":7,"unpackedSize":13362,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD5UFuy2mrpnVg2NgUqm9IOxHc7vkHsgCPuMnPgS8LDVQIgCeLr+rGx88AOk1Y50Qd5r5VHygX4+1mWC9lpVXmA1Ko="}]},"_npmUser":{"name":"dev-emito","email":"dev-npm-emito@sfer.co"},"directories":{},"maintainers":[{"name":"dev-emito","email":"dev-npm-emito@sfer.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/provider-twilio_0.1.0_1787412029391_0.6723617408551068"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-22T15:20:29.254Z","0.1.0":"2026-08-22T15:20:29.532Z","modified":"2026-08-22T15:20:29.734Z"},"maintainers":[{"name":"dev-emito","email":"dev-npm-emito@sfer.co"}],"description":"Twilio SMS provider plugin for Emito.","homepage":"https://github.com/emito-pro/emito/tree/main/packages/provider-twilio#readme","keywords":["emito","notifications","notification-infrastructure","self-hosted","twilio","sms","provider","plugin"],"repository":{"type":"git","url":"git+https://github.com/emito-pro/emito.git","directory":"packages/provider-twilio"},"author":{"name":"SFER LABS LLC"},"bugs":{"url":"https://github.com/emito-pro/emito/issues"},"license":"MIT","readme":"<div align=\"center\">\n  <img src=\"../../.github/assets/emito-logo.png\" width=\"120\" alt=\"Emito\" />\n\n  # @emito/provider-twilio\n\n  **Twilio SMS provider adapter for Emito.**\n\n  [![License](https://img.shields.io/badge/license-MIT-blue)](../../README.md)\n  [![Types](https://img.shields.io/badge/types-included-blue?logo=typescript&logoColor=white)](#)\n\n  ![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)\n  ![Zod](https://img.shields.io/badge/Zod-3E67B1?logo=zod&logoColor=white)\n</div>\n\n## What it is\n\n`@emito/provider-twilio` is the SMS delivery adapter that lets Emito send text\nmessages through [Twilio](https://www.twilio.com/). It wraps the official\n`twilio` SDK in a `ProviderPlugin` that the Emito core engine can register on\nthe `sms` channel — handling message dispatch, validating credentials at\nconstruction time, and translating Twilio's REST errors into Emito's typed\n`EmitoError` codes so the engine can decide what to retry and what to suppress.\n\n> Emito is provider-agnostic: the core engine speaks `ProviderPlugin`, and each\n> provider package teaches it how to talk to one delivery service. This package\n> is the Twilio implementation for SMS.\n\n## Install\n\nEmito is developed as a pnpm workspace; the `@emito/*` packages are consumed\nfrom within the monorepo. Add the provider to a workspace package as a\nworkspace dependency:\n\n```jsonc\n// package.json\n\"dependencies\": {\n  \"@emito/provider-twilio\": \"workspace:*\"\n}\n```\n\n> Standalone npm publishing of the `@emito/*` scope is planned but not yet\n> available — install from the workspace for now.\n\nThe package depends on the `twilio` SDK (bundled as a dependency) and is built\nto run alongside [`@emito/core`](../core/README.md), which consumes the provider\nit produces.\n\n## Usage\n\nCreate the provider with your Twilio credentials and register it on the `sms`\nchannel when you build your Emito instance:\n\n```ts\nimport { createEmito } from \"@emito/core\";\nimport { createTwilioProvider } from \"@emito/provider-twilio\";\n\nconst twilio = createTwilioProvider({\n  accountSid: process.env.TWILIO_ACCOUNT_SID!,\n  authToken: process.env.TWILIO_AUTH_TOKEN!,\n  fromNumber: process.env.TWILIO_FROM_NUMBER!, // e.g. \"+15551234567\"\n});\n\nconst emito = createEmito({\n  // ...database, redis, repositories, events...\n  channels: {\n    sms: {\n      providers: [twilio],\n    },\n  },\n});\n```\n\n`createTwilioProvider` validates its config eagerly: if `accountSid`,\n`authToken`, or `fromNumber` is missing, it throws an `EmitoError` with code\n`CONFIG_INVALID` before any message is sent.\n\n## API surface\n\n| Export | Kind | Description |\n| --- | --- | --- |\n| `createTwilioProvider(config)` | function | Builds a `ProviderPlugin` for the `sms` channel. Validates `config`, instantiates the Twilio client, and returns a plugin with `deliver` and `healthCheck`. |\n| `TwilioProviderConfig` | type | Shape of the provider config: `accountSid`, `authToken`, `fromNumber` (all required, non-empty strings). |\n| `TwilioProviderConfigSchema` | Zod schema | The `zod` schema used to validate `TwilioProviderConfig`, exported for reuse in your own config validation. |\n\nThe returned plugin reports `name: \"twilio\"` and `channel: \"sms\"`.\n\n### Error mapping\n\nTwilio REST errors raised during `deliver` are translated into Emito's typed\n`EmitoError` codes so the engine can apply the right retry and suppression\nbehavior:\n\n| Condition | Emito error code | Retryable |\n| --- | --- | --- |\n| HTTP `429` | `RATE_LIMITED` | yes |\n| Invalid `to`/`from` number (`21211`, `21614`) | `DELIVERY_INVALID_ADDRESS` | no |\n| Unsubscribed recipient (`21610`) | `DELIVERY_SPAM_COMPLAINT` | no |\n| Hard bounce (`30005`, `30006`) | `DELIVERY_HARD_BOUNCE` | no |\n| Destination unreachable (`30003`) | `PROVIDER_UNAVAILABLE` | yes |\n| Authentication failure (`20003`) | `CONFIG_INVALID` | no |\n| HTTP `5xx` | `PROVIDER_UNAVAILABLE` | yes |\n| Any other Twilio error | `DELIVERY_REJECTED` | no |\n\n## Part of Emito\n\n`@emito/provider-twilio` is one package in the [Emito](../../README.md)\nmonorepo — self-hosted, provider-agnostic notification infrastructure for\nNode.js and TypeScript.\n\n- **Core engine** — [`@emito/core`](../core/README.md)\n- **Shared types** — [`@emito/types`](../types/README.md)\n- **Other providers** — [`@emito/provider-resend`](../provider-resend/README.md), [`@emito/provider-fcm`](../provider-fcm/README.md)\n- See the full package list in the root [`README.md`](../../README.md).\n\n## License\n\nMIT — part of the [Emito](../../README.md) project.\n","readmeFilename":"README.md","_rev":"1-ff578ead371d354f8954295c5700a969"}