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

wa-sticker-toolkit

v0.1.0

Published

A package to create stickers for WhatsApp.

Readme

WA Sticker Toolkit

NPM CodeFactor NPM

Installation

Install via npm:

npm i wa-sticker-toolkit

Overview

wa-sticker-toolkit provides a simple way to create WhatsApp stickers from various sources such as Buffers, URLs, SVG strings, Base64-encoded images, file paths, GIFs, and videos. The output format is WebP, with GIFs and videos automatically converted into animated stickers.

Importing the Library

const {
    Sticker,
    createSticker,
    StickerTypes,
    TextPositions
} = require("wa-sticker-toolkit");
// ES6 import { Sticker, createSticker, StickerTypes, TextPositions } from "wa-sticker-toolkit";

Creating Stickers

There are two main ways to create stickers:

  1. Using the Sticker Constructor (Recommended)

    const sticker = new Sticker(image, {
        metadata: {
            pack: "My Pack", // Pack name
            author: "Me", // Author name
            id: "12345", // Sticker ID (auto-generated if omitted)
            categories: ["🤩", "🎉"] // Used for WhatsApp sticker search
        },
        type: StickerTypes.FILL, // Sticker type
        quality: 50, // Output quality (1-100)
        background: "#000000" // Background color
    });
    
    // Convert to buffer
    const buffer = await sticker.toBuffer();
    
    // Save to file
    await sticker.toFile("sticker.webp");
    
    // Send using Baileys-MD
    conn.sendMessage(jid, await sticker.toMessage());

    You can also chain methods for better readability:

    const buffer = await new Sticker(image)
        .setPack("My Pack")
        .setAuthor("Me")
        .setType(StickerTypes.FILL)
        .setCategories(["🤩", "🎉"])
        .setId("12345")
        .setBackground("#000000")
        .setQuality(50)
        .toBuffer();

Note: The image parameter can be a Buffer, URL, SVG string, Base64 string, or file path.


  1. Using createSticker Function

    const buffer = await createSticker(image, options);
    // Returns a Promise that resolves to a Buffer

Options

The second parameter (options) is an object that allows customization:

{
    metadata: {
        pack: "Pack Name",
        author: "Author Name",
        id: "Sticker ID",
        categories: ["🤣", "❤️"]
    },
    type: StickerTypes.FILL,  // 'default', 'crop', 'fill', 'circle'
    quality: 80,              // Integer (1-100)
    background: "#FFFFFF",    // Hex color or sharp color object
    borderWidth: 5,          // Border width (default: 0)
    borderColor: "#FF0000",  // Border color (default: white)
    borderRadius: "50%",     // Rounded corners (percentage or integer)
    text: {
        content: "Hello!",   // Text overlay
        color: "#FFFFFF",    // Text color (hex only)
        font: "Arial",       // Font family
        fontSize: 24,        // Font size
        position: TextPositions.BOTTOM // 'top', 'center', 'bottom'
    }
}

Sticker Types & Text Positions

Sticker Types

const StickerTypes = Object.freeze({
    DEFAULT: "default",
    CROPPED: "crop",
    FILL: "fill",
    CIRCLE: "circle"
});

Text Positions

const TextPositions = Object.freeze({
    TOP: "top",
    CENTER: "center",
    BOTTOM: "bottom"
});

Background Options

You can specify a background color in two ways:

Hex Color String:

{ "background": "#FFFFFF" }

Sharp Color Object:

{
    "background": {
        "r": 255,
        "g": 255,
        "b": 255,
        "alpha": 1
    }
}

Note: The text color only accepts hex codes.


Configuration

You can set custom paths for ffmpeg and ffprobe using the config system:

const { config } = require("wa-sticker-toolkit");

config.setConfig({
    ffmpegPath: "/custom/path/to/ffmpeg",
    ffprobePath: "/custom/path/to/ffprobe"
});

// use config.getConfig() to get config Object

If not set, the toolkit assumes ffmpeg and ffprobe are available in your system's PATH.


WhatsApp Sticker Metadata

WhatsApp stickers include metadata such as the pack name, author, and categories.

  1. Author & Pack Title

    Bold text: Pack title

    Remaining text: Author name

    This metadata is stored using Exif data embedded in the WebP file.

  2. Sticker Categories

    WhatsApp allows stickers to have emoji-based categories. Learn more.


Backward Compatibility

If you're migrating from wa-sticker-formatter or @shibam/sticker-maker, no major changes are needed—just update your import statements, and everything should work seamlessly.

Thanks for using wa-sticker-toolkit!


This program is licensed under the MIT license.