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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dxkit-org/whatsapp-link

v1.0.0

Published

TypeScript utility for generating WhatsApp chat/share links with phone number normalization and message support.

Downloads

10

Readme

WhatsApp Link Utility

TypeScript utility for generating WhatsApp chat/share links with phone number normalization and message support.

npm version TypeScript MIT License

Generate WhatsApp chat or share links with proper phone number formatting and optional pre-filled messages. Supports both wa.me and api.whatsapp.com links, as well as deep links for mobile apps.

Features

  • WhatsApp Link Generation - Create links to start chats or share messages
  • 🌍 Phone Number Normalization - Uses libphonenumber-js for robust parsing
  • ✉️ Message Support - Pre-fill messages in the chat
  • wa.me / api.whatsapp.com / Deep Link - Choose your preferred link type
  • 🌐 TypeScript - Full type safety and IDE support

Installation

npm install @dxkit-org/whatsapp-link

Usage

import { buildWhatsAppLink } from "@dxkit-org/whatsapp-link"

// Basic chat link
const url = buildWhatsAppLink({ number: "+919999999999" })
// https://wa.me/919999999999

// With message
const url2 = buildWhatsAppLink({ number: "+919999999999", message: "Hello!" })
// https://wa.me/919999999999?text=Hello%21

// Share-only (no number)
const url3 = buildWhatsAppLink({ message: "Check this out!" })
// https://api.whatsapp.com/send?text=Check%20this%20out%21

// Deep link (for mobile apps)
const url4 = buildWhatsAppLink({ number: "+919999999999", deepLink: true })
// whatsapp://send?phone=919999999999

// Use api.whatsapp.com instead of wa.me
const url5 = buildWhatsAppLink({ number: "+919999999999", preferWaMe: false })
// https://api.whatsapp.com/send?phone=919999999999

API

buildWhatsAppLink(options)

Options

| Name | Type | Description | | ---------------- | ----------- | -------------------------------------------------------------------- | | number | string | Phone number (international or local, optional for share-only links) | | message | string | Message to pre-fill (optional) | | preferWaMe | boolean | Use wa.me (default: true). If false, uses api.whatsapp.com | | deepLink | boolean | Use whatsapp:// deep link (default: false) | | defaultCountry | CountryCode | Country code for parsing local numbers (default: "IN") |

Returns

  • string - The WhatsApp link URL

Throws

  • Error if the phone number is invalid (when provided)

Development

# Install dependencies
npm install

# Build the project
npm run build

# Watch mode for development
npm run dev

# Type checking
npm run type-check

License

MIT