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

@messages-dev/sdk

v0.1.1

Published

Official TypeScript SDK for the messages.dev iMessage API. Send and receive iMessage and SMS messages from Node.js, Bun, and the browser.

Readme

The iMessage API for agents

Official TypeScript SDK for messages.dev. Send and receive iMessage and SMS over a simple REST API from Node.js, Bun, Deno, or the browser.

Installation

npm install @messages-dev/sdk

Get an API key

  1. Sign up at app.messages.dev.
  2. Go to API Keys and click Create Key. Copy the sk_live_... key, it's only shown once.
  3. Go to the Overview tab, scan the sandbox QR code with your phone, and send the activation text. Your sandbox is now paired with your number and you have 50 free messages per day.

Usage

import { createClient } from "@messages-dev/sdk";

const client = createClient();

await client.sendMessage({
  from: "+15551234567",
  to: "+15559876543",
  text: "Hello from the iMessage API!",
});

What you can do

Send messages with attachments and reply threading:

await client.sendMessage({
  from,
  to,
  text,
  attachments: ["file_abc"],
  replyTo: "msg_xyz",
});

Send reactions, typing indicators, and read receipts:

await client.sendReaction({ from, to, messageId, type: "love" });
await client.startTyping({ from, to });
await client.sendReadReceipt({ from, to });

Upload files and attach them to messages:

const file = await client.uploadFile({
  from,
  file: buffer,
  filename: "photo.jpg",
  mimeType: "image/jpeg",
});

await client.sendMessage({
  from,
  to,
  text: "Look",
  attachments: [file.id],
});

Receiving messages

Create a webhook from the Webhooks tab in your dashboard. Enter your endpoint URL, select the events you want to subscribe to, and copy the signing secret.

Verify incoming deliveries with verifyWebhook. Signatures use timing-safe HMAC-SHA256 and timestamps older than 5 minutes are rejected:

import { verifyWebhook } from "@messages-dev/sdk";

app.post("/webhooks", async (req, res) => {
  const event = await verifyWebhook(
    req.body,
    req.headers["x-webhook-signature"],
    process.env.WEBHOOK_SECRET,
  );

  if (event.event === "message.received") {
    console.log(`${event.data.sender}: ${event.data.text}`);
  }

  res.sendStatus(200);
});

Error handling

All errors extend MessagesError with code, param, status, and requestId:

import { RateLimitError, InvalidRequestError } from "@messages-dev/sdk";

try {
  await client.sendMessage({ from, to, text });
} catch (err) {
  if (err instanceof RateLimitError) {
    // back off
  } else if (err instanceof InvalidRequestError) {
    console.error(err.code, err.param);
  }
}

Configuration

createClient({
  apiKey: "sk_live_...",
  baseUrl: "https://api.messages.dev",
  timeout: 30_000,
  maxRetries: 2,
});

Retries use exponential backoff on 429 and 5xx responses. 4xx errors are returned immediately.

TypeScript

Types ship with the package:

import type { Line, Chat, Message, Reaction, Webhook, WebhookEvent } from "@messages-dev/sdk";

Zod schemas (MessageSchema, LineSchema, etc.) are also exported.

Links

License

MIT