@ienznotfound/yui-baileys
v1.0.2
Published
A WebSockets library for interacting with WhatsApp Web (Yui-Baileys Fork)
Maintainers
Readme
🎆 @ienznotfound/yui-baileys
A super lightweight, custom-modified WhatsApp API library focused on interactive messaging (Interactive UI) and modern native features.
📦 Installation
Via package.json (Baileys NPM Fork)
Replace the default module with this package for instant migration:
// If you were previously using @whiskeysockets/baileys
"dependencies": {
"@whiskeysockets/baileys": "npm:@ienznotfound/yui-baileys"
}// If you were previously using @adiwajshing/baileys
"dependencies": {
"@adiwajshing/baileys": "npm:@ienznotfound/yui-baileys"
}Or via Terminal (Non-fork)
npm install yui-baileys@npm:@ienznotfound/yui-baileysImporting (ESM & CJS)
ESM
import makeWASocket from '@ienznotfound/yui-baileys'CJS
const { default: makeWASocket } = require('@ienznotfound/yui-baileys')🚀 Key Features & Usage Examples
This library supports various modern WhatsApp features with an easy-to-use native format. Here are some usage examples:
🌟 AIRich (Rich Message)
Kirim pesan super interaktif (seperti table, post, reels, source, dll) secara langsung menggunakan struktur richMessage.
Berikut adalah contoh pengiriman untuk setiap jenis properti yang didukung oleh AIRich:
1. Text (Rich Markdown)
await sock.sendMessage(jid, {
richMessage: {
text: `# Halo Dunia\n## iEnz\n\n---\n\n=={ Yellow Text }==\n\n---\n\n[Google](https://google.com)`,
unifiedResponse: true // 🌟 Opsi untuk mengaktifkan / menonaktifkan format Unified Response
}
});2. Tip (Metadata Text)
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
tip: 'Ini adalah text tip (Metadata Text)'
}
});3. Product (Carousel / List)
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
product: [{
title: 'Yui Bot Premium',
brand: 'iEnz',
price: 'Rp 1000',
sale_price: 'Rp 0',
url: 'https://wa.me/6282139672290',
icon: 'https://cdn.example.com/icon.png',
image: 'https://cdn.example.com/product.jpg'
}]
}
});4. Code Snippet
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
unifiedResponse: false, // Opsi custom unifiedResponse flag (tergantung kebutuhan layout)
code: {
language: 'javascript',
code: `class Yui {\n\tstatic hello() {\n\t\treturn 'Hello World';\n\t}\n}`
}
}
});5. Table
await sock.sendMessage(jid, {
richMessage: {
table: [
['Nama', 'Role'],
['iEnz', 'Developer'],
['Yui', 'Assistant']
]
}
});6. Source Link
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
source: [
['https://cdn.example.com/icon.jpg', 'https://github.com/', 'GitHub']
]
}
});7. Image
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
image: 'https://cdn.example.com/image.jpg'
}
});8. Video
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
video: 'https://cdn.example.com/video.mp4|10' // Format: URL|Duration
}
});9. Reels
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
reels: [{
username: 'iEnz',
profile_url: 'https://cdn.example.com/profile.jpg',
thumbnail: 'https://cdn.example.com/thumb.jpg',
url: 'https://yui.ienz.my.id/',
title: 'Demo Reel',
like: 12000,
share: 500,
view: 999999,
source: 'IG',
verified: true
}]
}
});10. Post (Instagram Style)
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
post: [{
profile_url: 'https://cdn.example.com/profile.jpg',
username: 'iEnz',
title: 'Demo Post',
subtitle: 'Developer',
caption: 'hii~ im yui, just quietly observing things around here.',
verified: true,
url: 'https://yui.ienz.my.id/',
thumbnail: 'https://cdn.example.com/thumb.jpg',
source: 'INSTAGRAM',
footer: 'Yui Assistant',
deeplink: 'https://yui.ienz.my.id/',
icon: 'https://cdn.example.com/icon.jpg',
orientation: 'LANDSCAPE',
post_type: 'PHOTO',
comment: 1,
share: 1,
like: 1
}]
}
});11. Suggest / Quick Replies
await sock.sendMessage(jid, {
richMessage: {
title: '🤖 Yui-Assistant',
footer: '© iEnz',
suggest: ['Yui', 'iEnz', 'Menu']
}
});🔘 Interactive Buttons & Selection List
Combine standard buttons, link buttons (CTA), and dropdown menus (List) in a single message!
await sock.sendMessage(jid, {
text: "Select a menu below:",
footer: "© iEnz",
buttonV2: [
{ name: "quick_reply", buttonParamsJson: JSON.stringify({ display_text: "Menu 1", id: ".menu1" }) }
],
cta_url: { display_text: "Contact Owner", url: "https://wa.me/6285899292940" },
selectionList: {
title: "Menu List",
button_title: "Select Option",
sections: [{ title: "Main", rows: [{ title: "Ping", id: ".ping" }] }]
}
});📦 Sticker Pack (Native)
Parse and send Sticker Packs natively.
const fs = require('fs');
await sock.sendMessage(jid, {
stickerPackMessage: {
stickerPackId: "KZ4OOY",
name: "Yui Sticker Pack",
publisher: "iEnz",
description: "A collection of cute Yui stickers!",
trayIcon: fs.readFileSync('./trayIcon.png'), // Tray icon image (Buffer)
stickers: [
{ image: fs.readFileSync('./sticker1.webp'), isAnimated: true, emojis: ["😍", "🥰"] },
{ image: fs.readFileSync('./sticker2.webp'), isAnimated: false, emojis: ["😭", "😢"] },
{ image: fs.readFileSync('./sticker3.webp'), isAnimated: true, emojis: ["😂", "🤣"] }
]
}
});📱 Custom Pairing Code
Login to your WhatsApp bot without scanning a QR Code, just use an 8-digit Pairing Code! Spesial di repository ini, kamu bisa mengatur kode pairing-mu sendiri! (Catatan: Kode custom wajib tepat 8 karakter/digit).
const phoneNumber = "6285899292940"; // Nomor bot kamu
// Cara 1: Meminta pairing code standar (Baileys akan menggenerate kode random 8 karakter)
const code = await sock.requestPairingCode(phoneNumber);
console.log(`Your pairing code: ${code}`);
// Cara 2: Meminta pairing code dengan kode CUSTOM pilihanmu sendiri! (HARUS 8 DIGIT/KARAKTER)
const myCustomCode = await sock.requestPairingCode(phoneNumber, "YUI12345");
console.log(`Your custom pairing code: ${myCustomCode}`);📸 Live Photo (iOS / PTV Format)
Send animated Live Photos by associating a static image with a video!
const { prepareWAMessageMedia, generateWAMessageFromContent } = require('@ienznotfound/yui-baileys');
const fs = require('fs');
// Prepare Media
const imageMedia = await prepareWAMessageMedia({ image: fs.readFileSync('./image.jpg') }, { upload: sock.waUploadToServer });
const videoMedia = await prepareWAMessageMedia({ video: fs.readFileSync('./video.mp4') }, { upload: sock.waUploadToServer });
// 1. Generate & Send Image Message (pairedMediaType 5)
const msg = generateWAMessageFromContent(jid, {
imageMessage: {
...imageMedia.imageMessage,
contextInfo: { pairedMediaType: 5, statusSourceType: 0 }
}
}, {});
await sock.relayMessage(jid, msg.message, { messageId: msg.key.id });
// 2. Send Associated Video Message (pairedMediaType 6)
await sock.relayMessage(jid, {
videoMessage: {
...videoMedia.videoMessage,
contextInfo: { pairedMediaType: 6, statusSourceType: 0 },
},
messageContextInfo: {
messageAssociation: { associationType: 12, parentMessageKey: msg.key }
}
}, {});📍 Location Sharing & Wrapped Messages (Cased)
Share a complete location with coordinates and address. Use the cased: true option to wrap the location message into an Interactive Message format, allowing you to use it as a media header (with or without buttonV2)!
Example 1: Interactive Location Header with Custom Image (cased: true)
const fs = require('fs');
await sock.sendMessage(jid, {
text: "Here is your requested song:",
footer: "© iEnz",
location: {
degreesLatitude: 0,
degreesLongitude: 0,
name: "Video Title",
address: "Duration: 3:00 | Author: iEnz",
jpegThumbnail: fs.readFileSync('./thumbnail.jpg') // 🖼️ Gambar kustom untuk header
},
cased: true, // 🌟 Wraps the location as an interactive message header
buttonV2: [
{ name: "quick_reply", buttonParamsJson: JSON.stringify({ display_text: "Download MP3", id: ".mp3" }) },
{ name: "quick_reply", buttonParamsJson: JSON.stringify({ display_text: "Download MP4", id: ".mp4" }) }
]
});Example 2: Standard WhatsApp Location Message (cased: false)
await sock.sendMessage(jid, {
location: {
degreesLatitude: -6.225014,
degreesLongitude: 106.802223,
name: "Sudirman Central Business District",
address: "Jakarta Selatan"
},
cased: false // 📍 Sends as a regular map location pin
});📊 Poll Creation
Create polls for quick voting in group or private chats.
await sock.sendMessage(jid, {
poll: {
name: "Select your favorite language",
values: ["JavaScript", "Python", "TypeScript"],
selectableCount: 1
}
});🖼️ Send Album (Native)
Send a collection of media (images or videos) grouped as a single stacked message (album / carousel-like format) directly without any hassle!
await sock.sendAlbumMessage(jid, [
{ image: { url: "https://files.catbox.moe/img1.jpg" }, caption: "Image 1" },
{ image: { url: "https://files.catbox.moe/img2.jpg" }, caption: "Image 2" },
{ video: { url: "https://files.catbox.moe/vid1.mp4" }, caption: "Video 1" }
]);👥 LID Group Mapping
Handle all group management or operations using the @lid address format securely and automatically without the need for manual parsing!
Just pass the ID/JID to a group operation (like sock.groupParticipantsUpdate) and we will handle it.
