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

@unifers/messenger

v1.0.0

Published

Communication module

Readme

Messenger

Communication module

Reuse a MongoDB connection

Optionally pass your existing Mongoose connection to use it for both email and SMS logs:

Messenger.init({
    fromMail,
    replyMail,
    templates,
    mongoConnection: mongoose.connection,
    mailLog: { enabled: true },
    smsLog: { enabled: true }
});

Messenger uses the supplied connection directly, without reconnecting, changing its settings, or closing it. Your application manages its lifecycle. MONGO_URI is unnecessary when a connection is supplied; otherwise Messenger uses MONGO_URI as before. Direct send functions also accept mongoConnection in their log config. The top-level connection takes priority.

Email logs

Enable MongoDB email logging with LOG_EMAIL_ENABLE=true or mailLog: { enabled: true } in Messenger.init(). Explicit mailLog.enabled takes priority. LOG_MAIL_ENABLE remains a fallback when LOG_EMAIL_ENABLE is unset. Writes are skipped when neither a supplied connection nor a nonempty MONGO_URI is available.

SMS logs

Enable MongoDB SMS logging with LOG_SMS_ENABLE=true or smsLog: { enabled: true } in Messenger.init(). Set MONGO_URI and optionally MONGO_DB_NAME using the shared MongoDB connection. Logs are stored in smsLogs with the recipient, template, status, attempted providers, attempt count, error, duration, dry-run flag, and timestamps.

Pass { userId, source, requestId, enabled } as the optional second argument to Messenger.sendSms() for per-call metadata or to override logging. Direct sendSms() calls accept those options as the second argument and an SMS log config as the third.

Writes run in the background. Without a supplied connection, missing or empty MONGO_URI skips writes; Messenger.init() prints a skip message. Write failures call smsLog.onError(error, context) or log to the console without failing SMS delivery. Messenger.closeSmsLog() closes the shared MongoDB connection used by both email and SMS logs.