New Message Types
UDMODZ Edition supports a set of premium, high-impact message structures. All of these types are integrated directly into the standard sock.sendMessage(jid, content) API.
🛠️ Message Builder (AIRich)
The AIRich class is a high-level builder for creating complex, interactive messages with dynamic update capabilities. It is the most powerful tool for building "AI-like" conversational flows.
Basic Example
import { AIRich } from 'amiudmodz'
const rich = new AIRich(conn)
.setTitle('Dynamic Builder')
.addText('Hello! This is a live message.')
.addSuggest(['Help', 'About', 'Contact'])
.setFooter('Built with AIRich');
await rich.send(jid);
Advanced Surgical Updates
AIRich supports surgical updates, allowing you to modify specific parts of a message without resending the entire text bubble. This is achieved using unique node ids.
const rich = new AIRich(conn)
.setTitle('Surgical Updates')
.addText('Initial content.', { id: 'header' });
await rich.send(jid);
// 1. Surgical Insertion
// Inserts new text immediately after the node with id 'header'
rich.addText('This text was inserted surgically.', { insertAt: 'header', id: 'middle' });
await rich.sendEdit();
// 2. Dynamic Replacement (Ideal for loading states)
// First, show a placeholder
rich.addImage('', { status: 'GENERATING', update_text: 'Generating image...', id: 'img' });
await rich.sendEdit();
// Later, replace the placeholder with real content
rich.addImage('https://example.com/final.jpg', { replace: 'img' });
await rich.sendEdit();
// 3. Live Deletion
// Removes the node with id 'middle' from the message
rich.delete('middle');
await rich.sendEdit();
Methods Summary
| Method | Options | Description |
|---|---|---|
addText | { id, insertAt, replace } | Adds markdown text. |
addImage | { status, update_text, width, height, id, replace, insertAt } | Adds an image with optional generating status. |
addVideo | { autoFill, status, estimatedTime, id, replace, insertAt } | Adds a video. autoFill automatically fetches metadata. |
addCode | { lang, code, id, replace, insertAt } | Adds syntax-highlighted code. |
addTable | { data, id, replace, insertAt } | Adds formatted tables (data is string[][]). |
addSuggest | { items, id, replace, insertAt } | Adds suggestion pills (buttons). |
addWidget | { data, layout, id, replace, insertAt } | Adds complex widgets with custom CTAs. |
delete | id | Removes a specific node by its ID. |
🎨 Premium Rich Menu (conn.menurich)
amiudmodz includes a built-in premium card rendering API called menurich. It generates a high-fidelity visual layout with custom headers, scrollable card lists, toasts, and open URLs.
[!TIP] Optimization: Images in
menurichnow render directly for users without requiring a "Download to view" interaction.
await conn.menurich(jid, {
title: "# Queen UDMODZ VIP",
subtitle: "UDMODZ Baileys is active~",
imageUrl: "https://i.ibb.co/5xzWmSxn/20250224-094453.png",
menus: [
{
title: "LIST-1",
buttons: [
{ label: "menu", id: ".menu", toast: "UDMODZ" },
{ label: "profile", id: ".profile", toast: "UDMODZ" },
{ label: "script", id: ".script", toast: "UDMODZ" }
]
}
],
footerLinks: [
{ label: "UDMODZ Group", url: "https://chat.whatsapp.com/J7Bl2AGIcNEYsdch" }
]
})
🤖 Meta AI Icon
Add the native cyan Meta AI ✦ icon to any text message.
await sock.sendMessage(jid, {
text: "Hello! I am your AI assistant.",
ai: true
})
💬 AI Disclaimer
Add a small, subtle AI disclaimer banner underneath the message text.
await sock.sendMessage(jid, {
text: "Here is your translated document.",
aiDisclaimer: "Generated using deep learning translation models."
})
💻 Code Block (Rich Response)
Render a syntax-highlighted code block with a language indicator, formatted in WhatsApp's premium AI style.
await sock.sendMessage(jid, {
contentText: "Check out this TypeScript example:",
code: `const sum = (a: number, b: number): number => {\n return a + b;\n};`,
language: "typescript" // optional: javascript, python, bash, go, etc.
})
📊 Table (Rich Response)
Render a structured, formatted data table. The first row is treated as the column headers automatically.
await sock.sendMessage(jid, {
contentText: "Monthly server metrics:",
title: "Server Performance",
table: [
["Server", "Uptime", "Load"],
["Node-01", "99.99%", "0.42"],
["Node-02", "99.95%", "0.85"],
["Db-Repl", "100.0%", "0.15"]
]
// noHeading: true // Set to true to treat the first row as normal data
})
🎞️ Album Message
Send multiple images or videos grouped together as a WhatsApp media album.
await sock.sendMessage(jid, {
album: [
{ image: { url: 'https://example.com/cover.jpg' }, caption: 'Cover photo' },
{ image: { url: 'https://example.com/banner.jpg' }, caption: 'Banner image' },
{ video: { url: 'https://example.com/trailer.mp4' }, caption: 'Launch trailer' }
]
})
🗓️ Event Card
Send native, interactive WhatsApp event invitation cards.
await sock.sendMessage(jid, {
event: {
name: "Hackathon Kickoff 🚀",
description: "Introductory session, team matching, and challenge reveal.",
location: "Discord Developer Lounge",
startDate: new Date(Date.now() + 24 * 3600 * 1000), // tomorrow
endDate: new Date(Date.now() + 26 * 3600 * 1000) // 2 hours duration
}
})
📹 PTV (Round Video Note)
Send circular, auto-playing video note bubbles (similar to video notes in Telegram or WhatsApp's push-to-video notes).
await sock.sendMessage(jid, {
video: { url: 'https://example.com/reaction.mp4' },
ptv: true
})
📣 Mention All Group Members
Tag all participants in a group chat automatically without fetching group metadata or manually listing every JID.
await sock.sendMessage(jid, {
text: "Important announcement! 📢 Please read.",
mentionAll: true
})
🧾 Rich Response (Mixed Custom Layout)
Compose custom layouts mixing free text, tables, and code blocks inside a single message payload.
await sock.sendMessage(jid, {
richResponse: [
{ text: "Here is the summary of packages:" },
{
table: [
{ isHeader: true, items: ["Package", "Version", "Status"] },
{ isHeader: false, items: ["amiudmodz", "1.0.0", "Installed"] },
{ isHeader: false, items: ["typescript", "5.4.2", "Up-to-date"] }
],
title: "Dependency Status"
},
{
code: [
{ highlightType: 1, codeContent: "npm" },
{ highlightType: 0, codeContent: " run dev" }
],
language: "bash"
}
]
})