Create WhatsApp stickers from images or videos, with optional metadata embedding for use with Baileys.
Ensure you have Node.js installed, then install the necessary package:
npm install sticker-maker-wa
const { createSticker } = require("sticker-maker-wa");
const { readFile } = require("fs/promises");
async function main() {
const imagePath = "./path/your_image.png";
const image = await readFile(imagePath);
const sticker = await createSticker(image, {
metadata: {
packname: "Pack Name",
author: "Author Name",
},
});
socket.sendMessage(jid, { sticker });
}
main();
If you are creating animated stickers (video to WebP), make sure you have ffmpeg installed on your system. Here's how to use the createSticker function (also works for static stickers):
npm install ffmpeg-static
const { createSticker } = require("sticker-maker-wa");
const { readFile } = require("fs/promises");
const ffmpegPath = require("ffmpeg-static");
async function main() {
const videoPath = "./path/your_video.mp4";
const video = await readFile(videoPath);
const sticker = await createSticker(video, {
ffmpeg: ffmpegPath,
metadata: {
packname: "Pack Name",
author: "Author Name",
},
});
socket.sendMessage(jid, { sticker });
}
main();
createSticker(input, options)
Buffer | Readable
Object
(optional)
string
(required in case you want it to be an animated sticker)Object
(optional)
string
string