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

@wakio/sdk

v0.2.0

Published

Send email through Wakio from Node, Bun and edge runtimes

Readme

@wakio/sdk

Send email through Wakio from Node, Bun, Cloudflare Workers and Vercel Edge.

npm install @wakio/sdk
import { Wakio } from "@wakio/sdk"

const wakio = new Wakio({ apiKey: process.env.WAKIO_API_KEY })

await wakio.emails.send({
  to: user.email,
  subject: "Welcome to Acme",
  html: "<p>Thanks for signing up.</p>",
})
  • Recipients by address or with a name: to: "Maya Lee <[email protected]>" works for to, cc and bcc.
  • React Email: new Wakio({ render }) with render from @react-email/render, then send react: <Welcome />.
  • Nodemailer 6 to 10: nodemailer.createTransport(wakioTransport()) from @wakio/sdk/nodemailer.
  • Retries with idempotency keys, so a retry never sends twice.
  • Errors that say whether retrying can help: WakioRejectedError, WakioMisconfiguredError, WakioError.
  • Contacts on lists: wakio.contacts.create({ email, subscribed: true, lists: ["lst_8mQ2xYtV4kP7cNwR3dZfHa"] }) answers with each list the contact is on or has left, and each list you named that Wakio did not add them to, with the reason as its status, such as withdrawn.

Native integrations: @wakio/sdk/nestjs, @wakio/sdk/authjs, @wakio/sdk/payload, @wakio/sdk/medusa. Guides for Express, Next.js, Astro, NestJS, Auth.js, Better Auth, Payload and Medusa. Full reference: wakio.net/docs/api/node.

Attaching metadata to a send

Pass metadata, an object with string values (the server refuses a number, so use String(order.id); limits are on the webhooks page), and it comes back on every webhook event for that email:

await wakio.emails.send({ to: user.email, subject: "Your receipt", html, metadata: { order_id: String(order.id) } })

Through @wakio/sdk/nodemailer and @wakio/sdk/payload, set the X-Wakio-Metadata header to a JSON object instead: headers: { "X-Wakio-Metadata": JSON.stringify({ order_id: String(order.id) }) }. It becomes metadata and is never sent as a mail header. A value that is not a JSON object throws WakioRejectedError before any request.

Verifying webhooks

verifyWebhook checks the signature and the timestamp of a webhook request and returns the parsed event. Pass the body as text, not as parsed JSON.

import { verifyWebhook, WakioWebhookError } from "@wakio/sdk"

export async function POST(request: Request) {
  const payload = await request.text()
  try {
    const event = await verifyWebhook({ payload, headers: request.headers, secret: process.env.WAKIO_WEBHOOK_SECRET! })
    await handleWakioEvent(event)
    return new Response(null, { status: 200 })
  } catch (error) {
    if (error instanceof WakioWebhookError) return new Response(null, { status: 400 })
    throw error
  }
}

headers can be a Headers or a plain record; names are matched without regard to case. A timestamp more than 300 seconds from now, in either direction (toleranceSeconds changes it), a missing header, a signature that does not match and a secret that is not a whsec_ secret all throw WakioWebhookError. During a secret rotation the request carries two signatures and either one passes. It uses Web Crypto, so it runs on Node, Bun, Cloudflare Workers and Vercel Edge. Full reference: wakio.net/docs/api/webhooks.

MIT licensed.