贝利斯
WhatsApp Baileys是一个开源库,旨在帮助开发者与WhatsApp高效并直接地构建自动化解决方案和集成. 这个库使用websocket技术而无需浏览器,支持多种功能,如消息管理,聊天处理,分组管理,以及互动消息和动作按钮,以获得更动态的用户体验.
积极发展和维持,Baileys不断收到最新情况,以提高稳定性和业绩。 主要重点之一是改进配对和认证程序,以更加稳定和安全。 配对功能可以用自有代码定制,使过程更加可靠并更不易被中断.
这个图书馆非常适合建设商业bots,聊天自动化系统,客户服务解决方案,以及需要高稳定性和综合功能的各种其他通信自动化应用. 有了轻量级和模块化的设计,Baileys很容易被整合到不同的系统和平台中.
主要特点和优点
- 支持自动和自定义配对程序
- 修复以往常常导致故障或断开的对接问题
- 支持交互式消息、动作按钮和动态菜单
- 为可靠操作进行高效的自动会话管理
- 与 WhatsApp 的最新多设备特性兼容
- 轻而易举、稳定和容易融入各种系统
- 适合开发bots、自动化和完整的通信解决方案
- 促进发展的综合文件和示范守则
开始
首先通过您首选的软件包管理器安装库, 然后遵循所提供的配置指南 。 也可以使用现成的示例代码来理解特征是如何工作的. 使用会话存储和交互式消息功能来构建适合您业务或项目需要的完整,稳定的解决方案.
添加函数( 简单代码)
检查ID 频道
获取身份识别通道
await sock.newsletterId(url)
检查禁用号码
您可以在这里看到被封锁的数字状态
await sock.checkWhatsApp(jid)
发送信使文档
状态组信件 V2
以版本 2 发送组状态
await sock.sendMessage(jid, {
groupStatusMessage: {
text: "Hello World"
}
});
相册信件( 多张图像)
在单个相册消息中发送多张图像 :
await sock.sendMessage(jid, {
albumMessage: [
{ image: cihuy, caption: "Foto pertama" },
{ image: { url: "URL IMAGE" }, caption: "Foto kedua" }
]
}, { quoted: m });
事件消息
创建并发送WhatsApp事件邀请 :
await sock.sendMessage(jid, {
eventMessage: {
isCanceled: false,
name: "Hello World",
description: "yume native",
location: {
degreesLatitude: 0,
degreesLongitude: 0,
name: "rowrrrr"
},
joinLink: "https://call.whatsapp.com/video/yumevtc",
startTime: "1763019000",
endTime: "1763026200",
extraGuestsAllowed: false
}
}, { quoted: m });
播放结果信件
显示计票结果 :
await sock.sendMessage(jid, {
pollResultMessage: {
name: "Hello World",
pollVotes: [
{
optionName: "TEST 1",
optionVoteCount: "112233"
},
{
optionName: "TEST 2",
optionVoteCount: "1"
}
]
}
}, { quoted: m });
简单的交互式信件
发送带有复制按钮功能的基本交互消息 :
await sock.sendMessage(jid, {
interactiveMessage: {
header: "Hello World",
title: "Hello World",
footer: "telegram: @yumevtc ",
buttons: [
{
name: "cta_copy",
buttonParamsJson: JSON.stringify({
display_text: "copy code",
id: "123456789",
copy_code: "ABC123XYZ"
})
}
]
}
}, { quoted: m });
与本地流交互信件
发送带有按钮、复制动作和本地流程特性的交互式消息 :
await sock.sendMessage(jid, {
interactiveMessage: {
header: "Hello World",
title: "Hello World",
footer: "telegram: @yumevtc",
image: { url: "https://example.com/image.jpg" },
nativeFlowMessage: {
messageParamsJson: JSON.stringify({
limited_time_offer: {
text: "idk hummmm?",
url: "https://t.me/yumevtc",
copy_code: "yume",
expiration_time: Date.now() * 999
},
bottom_sheet: {
in_thread_buttons_limit: 2,
divider_indices: [1, 2, 3, 4, 5, 999],
list_title: "yume native",
button_title: "yume native"
},
tap_target_configuration: {
title: " X ",
description: "bomboclard",
canonical_url: "https://t.me/yumevtc",
domain: "shop.example.com",
button_index: 0
}
}),
buttons: [
{
name: "single_select",
buttonParamsJson: JSON.stringify({
has_multiple_buttons: true
})
},
{
name: "call_permission_request",
buttonParamsJson: JSON.stringify({
has_multiple_buttons: true
})
},
{
name: "single_select",
buttonParamsJson: JSON.stringify({
title: "Hello World",
sections: [
{
title: "title",
highlight_label: "label",
rows: [
{
title: "@yumevtc",
description: "love you",
id: "row_2"
}
]
}
],
has_multiple_buttons: true
})
},
{
name: "cta_copy",
buttonParamsJson: JSON.stringify({
display_text: "copy code",
id: "123456789",
copy_code: "ABC123XYZ"
})
}
]
}
}
}, { quoted: m });
与缩略图交互信件
用缩略图图像发送交互式消息并复制按钮 :
await sock.sendMessage(jid, {
interactiveMessage: {
header: "Hello World",
title: "Hello World",
footer: "telegram: @yumevtc",
image: { url: "https://example.com/image.jpg" },
buttons: [
{
name: "cta_copy",
buttonParamsJson: JSON.stringify({
display_text: "copy code",
id: "123456789",
copy_code: "ABC123XYZ"
})
}
]
}
}, { quoted: m });
产品消息
发送带有按钮和商家信息的产品目录信息 :
await sock.sendMessage(jid, {
productMessage: {
title: "Produk Contoh",
description: "Ini adalah deskripsi produk",
thumbnail: { url: "https://example.com/image.jpg" },
productId: "PROD001",
retailerId: "RETAIL001",
url: "https://example.com/product",
body: "Detail produk",
footer: "Harga spesial",
priceAmount1000: 50000,
currencyCode: "USD",
buttons: [
{
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: "Beli Sekarang",
url: "https://example.com/buy"
})
}
]
}
}, { quoted: m });
与文档缓冲交互信件
从缓冲器(文件系统)发送交互式消息 - 注意: 文档仅支持缓冲数字 :
await sock.sendMessage(jid, {
interactiveMessage: {
header: "Hello World",
title: "Hello World",
footer: "telegram: @yumevtc",
document: fs.readFileSync("./package.json"),
mimetype: "application/pdf",
fileName: "yumevtc.pdf",
jpegThumbnail: fs.readFileSync("./document.jpeg"),
contextInfo: {
mentionedJid: [jid],
forwardingScore: 777,
isForwarded: false
},
externalAdReply: {
title: "shenń Bot",
body: "anu team",
mediaType: 3,
thumbnailUrl: "https://example.com/image.jpg",
mediaUrl: " X ",
sourceUrl: "https://t.me/yumevtc",
showAdAttribution: true,
renderLargerThumbnail: false
},
buttons: [
{
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: "Telegram",
url: "https://t.me/yumevtc",
merchant_url: "https://t.me/yumevtc"
})
}
]
}
}, { quoted: m });
与文档缓冲( 简单) 交互信件
从缓冲器(文件系统)发送交互式消息,而不包含上下文Info和外部AdReply - 注意: 文档仅支持缓冲数字 :
await sock.sendMessage(jid, {
interactiveMessage: {
header: "Hello World",
title: "Hello World",
footer: "telegram: @yumevtc",
document: fs.readFileSync("./package.json"),
mimetype: "application/pdf",
fileName: "yumevtc.pdf",
jpegThumbnail: fs.readFileSync("./document.jpeg"),
buttons: [
{
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: "Telegram",
url: "https://t.me/yumevtc",
merchant_url: "https://t.me/yumevtc"
})
}
]
}
}, { quoted: m });
请求支付信件
发送带有自定义背景和标签的支付请求信件 :
let quotedType = m.quoted?.mtype || '';
let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
await sock.sendMessage(jid, {
requestPaymentMessage: {
currency: "IDR",
amount: 10000000,
from: m.sender,
sticker: JSON.parse(quotedContent),
background: {
id: "100",
fileLength: "0",
width: 1000,
height: 1000,
mimetype: "image/webp",
placeholderArgb: 0xFF00FFFF,
textArgb: 0xFFFFFFFF,
subtextArgb: 0xFFAA00FF
}
}
}, { quoted: m });
为什么选择什么App贝利斯?
因为这个库提供了高度的稳定性,完整的特征,以及积极改进的配对过程. 对于旨在创建专业和安全WhatsApp自动化解决方案的开发者来说,这是理想的. 对最新WhatsApp特性的支持确保了与平台更新的兼容性.
技术说明
- 支持稳定和安全的自定义配对代码
- 解决以前与配对和认证有关的问题
- 用于创建动态菜单的交互式消息和动作按钮
- 为长期稳定进行自动而有效的会话管理
- 与 WhatsApp 的最新多设备特性兼容
- 根据您的需要方便地整合和定制
- 适合开发bots、客户服务自动化和其他通信应用程序
关于完整的文件、安装指南和执行实例,请访问官方文献库和社区论坛。 我们不断更新和改进这个库,以满足现代WhatsApp自动化解决方案的开发者和用户的需要.
谢谢你选择WhatsApp Baileys 作为你的WhatsApp自动化解决方案!