> npm i wa-sticker-formatter
Before getting started, you need to know some basic information about WhatsApp Sticker Metadata.
In WhatsApp, stickers have their own metadata embedded in the WebP file. They hold info like the author, the title or pack name, the category.
Let's go through them one by one.
The text on bold is the pack title and the rest is the author. This is actually Exif Metadata embedded in the WebP file.
This is an array of Emojis. Learn More
Wa-Sticker-Formatter provides two ways to create stickers. The paramers are the same for both.
First is the Buffer, URL or File path of static image, GIF or Video. The second is the options. GIFs and Videos will output an animated WebP file.
Sticker options are:
pack
- The pack name.
author
- The author name.
type
- Value from StickeTypes enum (exported). Can be 'crop' or 'full' or undefined (default).
categories
- The sticker category. Can be an array of Emojis or undefined (default).
id
- The sticker id. If this property is not defined, it will be generated.
Example:
import { Sticker } from 'wa-sticker-formatter'
// const { Sticker } = require('wa-sticker-formatter')
const image = 'https://c.tenor.com/WZBvSgw5JMgAAAAC/watson-amelia-amelia-watson.gif'
(async () => {
const stickerMetadata = {
type: StickerTypes.CROPPED,
pack: 'watson',
author: 'amelia',
categories: [
'🌹'
]
}
const sticker = await new Sticker(image, stickerMetadata).build()
})()
import { createSticker, StickerTypes } from 'wa-sticker-formatter'
// const { createSticker } = require('wa-sticker-formatter')
const image = 'https://c.tenor.com/WZBvSgw5JMgAAAAC/watson-amelia-amelia-watson.gif' // Supports Buffer, URLs and filepath of Static Images, GIFs and Videos
(async () => {
const stickerMetadata = {
type: StickerTypes.FULL, //can be full or crop
pack: 'watson',
author: 'amelia',
categories: [
'🌹'
]
}
const sticker = await createSticker(image, stickerMetadata)
})()