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

@keystrokehq/twilio

v0.0.8

Published

Official Keystroke integration for [Twilio](https://www.twilio.com). Phase 1 ships Twilio's core transactional communication surface: Programmable SMS/MMS, Messaging Services (A2P 10DLC, toll-free verification, alpha senders), Programmable Voice (calls, r

Downloads

729

Readme

@keystrokehq/twilio

Official Keystroke integration for Twilio. Phase 1 ships Twilio's core transactional communication surface: Programmable SMS/MMS, Messaging Services (A2P 10DLC, toll-free verification, alpha senders), Programmable Voice (calls, recordings, conferences), Verify v2 (OTP, factors, challenges), Lookups v1/v2, Conversations v1 (default and service-scoped), phone-number provisioning, and account / API-key management.

Later phases will add Studio, TaskRouter, Flex, Programmable Video, Event Streams, Super SIM, Serverless, Sync, Insights, Bulk Exports, Trust Hub, Numbers (porting / hosted / regulatory), SIP, Marketplace, Pricing, Notify, Monitor, and Access Token minting.

Install

pnpm add @keystrokehq/twilio

Connect

Twilio is an API-key integration. Store these values in your Keystroke vault:

| Vault key | Required | Notes | | --------------------------- | -------- | ------------------------------------------------------------------- | | TWILIO_ACCOUNT_SID | yes | Primary or subaccount SID (AC…). | | TWILIO_AUTH_TOKEN | yes | Primary account auth token. Used for REST fallback and HMAC-SHA1 webhook signature verification. | | TWILIO_API_KEY_SID | no | Preferred REST principal (SK…). Use with TWILIO_API_KEY_SECRET. | | TWILIO_API_KEY_SECRET | no | Secret paired with TWILIO_API_KEY_SID. | | TWILIO_SUBACCOUNT_SID | no | Target a subaccount without rotating principals. |

import { twilio } from '@keystrokehq/twilio/connection';

Send an SMS

import { sendMessage } from '@keystrokehq/twilio/messaging';

await sendMessage.run({
  to: '+15551230001',
  from: '+15559990001',
  body: 'Hello from Keystroke.',
});

Verify an OTP

import {
  createVerification,
  createVerificationCheck,
} from '@keystrokehq/twilio/verify';

await createVerification.run({
  serviceSid: 'VAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  to: '+15551230001',
  channel: 'sms',
});

await createVerificationCheck.run({
  serviceSid: 'VAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  to: '+15551230001',
  code: '123456',
});

Look up a phone number (line type intelligence)

import { lookupPhoneNumberV2 } from '@keystrokehq/twilio/lookups';

const profile = await lookupPhoneNumberV2.run({
  phoneNumber: '+15551230001',
  fields: ['line_type_intelligence', 'caller_name'],
});

Triggers

Every Phase 1 trigger is a direct-binding webhook helper verified with X-Twilio-Signature. Expose the returned bindings inside a Keystroke workflow.

import { webhooks } from '@keystrokehq/twilio/triggers';

export const onInboundSms = webhooks.incomingMessage({
  filter: (payload) => payload.body?.includes('STOP') === false,
});

export const onCallCompleted = webhooks.callStatusCompleted();

export const onVerificationApproved = webhooks.verifyVerificationApproved();

export const onMessageAdded = webhooks.conversationsOnMessageAdded();

Support surface

| Subpath | Purpose | | ---------------------------------------------------- | ----------------------------------------------------------- | | @keystrokehq/twilio/connection | Public credential set, TwilioCredentials type. | | @keystrokehq/twilio/client | Hand-rolled fetch client (for custom operations). | | @keystrokehq/twilio/schemas | Zod schemas for every resource and webhook payload. | | @keystrokehq/twilio/events | Twilio event-type string unions and enums. | | @keystrokehq/twilio/verification | verifyTwilioWebhookRequest, signature base-string helper. | | @keystrokehq/twilio/errors | TwilioApiError class and classification. | | @keystrokehq/twilio/messaging | Programmable SMS / MMS / Media / Short Codes. | | @keystrokehq/twilio/messaging-services | Messaging Services + A2P 10DLC + toll-free verification. | | @keystrokehq/twilio/voice | Calls, call events, feedback, notifications. | | @keystrokehq/twilio/recordings | Recordings, transcriptions, add-on results. | | @keystrokehq/twilio/conferences | Conferences, participants, conference recordings. | | @keystrokehq/twilio/phone-numbers | Available + incoming phone numbers, caller IDs, addresses. | | @keystrokehq/twilio/accounts | Accounts, subaccounts, balance. | | @keystrokehq/twilio/keys | API keys, signing keys, connect apps, network traversal. | | @keystrokehq/twilio/verify | Verify v2: services, verifications, factors, challenges. | | @keystrokehq/twilio/lookups | Lookups v1 + v2. | | @keystrokehq/twilio/conversations | Conversations v1 default scope. | | @keystrokehq/twilio/conversation-services| Conversations v1 service-scoped. |

Hidden subpaths (_official, _runtime) are for Keystroke platform use only. End-user authoring code must not import them.

Webhook signature verification

All Phase 1 triggers call verifyTwilioWebhookRequest internally. For custom webhook endpoints outside this package, import the helper directly:

import { verifyTwilioWebhookRequest } from '@keystrokehq/twilio/verification';

const result = verifyTwilioWebhookRequest({
  url: request.url,
  method: request.method,
  headers: request.headers,
  rawBody: request.rawBody,
  form: request.form,
  authToken: credentials.TWILIO_AUTH_TOKEN,
});

if (!result.valid) {
  throw new Error(`Twilio webhook rejected: ${result.reason}`);
}

JSON-bodied webhooks (Conversations service-scoped, Event Streams, some Flex callbacks) are verified via the bodySHA256 query parameter plus the signature; the helper handles both encodings.

License

MIT