node -v
npm init -y npm install velixs-md
{ key: { remoteJid: '6287716494751@s.whatsapp.net', fromMe: false, id: 'F899BD0CBE69A8DBFCD31E0CFCE8389E', participant: undefined }, messageTimestamp: 1737539549, pushName: 'Rian Jawa', broadcast: false, message: Message { conversation: 'Ll', messageContextInfo: MessageContextInfo { deviceListMetadata: [DeviceListMetadata], deviceListMetadataVersion: 2, messageSecret: [Uint8Array] } }, sessionId: 'session001', saveImage: [Function (anonymous)], saveVideo: [Function (anonymous)], saveDocument: [Function (anonymous)] }
const whatsapp = require('velixs-md') whatsapp.startSession('session002'); whatsapp.onConnected(async (session) => { console.log("session connected : " + session); }) whatsapp.onMessageReceived(async(msg)=>{ if (msg.key.fromMe || msg.key.remoteJid.includes("status")) return; await whatsapp.sendTyping({ sessionId: msg.sessionId, to: msg.key.remoteJid, duration: 3000, }); })
const whatsapp = require('velixs-md') whatsapp.startSession('session001'); whatsapp.onConnected(async (session) => { console.log("session connected : " + session); }) whatsapp.onMessageReceived(async(msg)=>{ if (msg.key.fromMe || msg.key.remoteJid.includes("status")) return; //input = msg.message?.extendedTextMessage?.text; console.log(msg); console.log(msg.message.conversation); input = msg.message.conversation; const opening = ["send all", "sendall", "send-all"]; //const res = opening.filter(n=>input.includes(n)); if (opening.filter(n=>input.includes(n)).length == 1){ const arr = ["6287716494751", "6283144865112"] for (const x of arr) { console.log(x) await whatsapp.sendTextMessage({ sessionId: "session001", // session ID to: x, // always add country code (ex: 62) text: "aq lagi uji server robot : ini cuman uji coba loh yaa", // message you want to send }); } } })
const whatsapp = require('velixs-md') whatsapp.startSession('session001'); whatsapp.onConnected(async (session) => { console.log("session connected : " + session); }) whatsapp.onMessageReceived(async(msg)=>{ if (msg.key.fromMe || msg.key.remoteJid.includes("status")) return; //input = msg.message?.extendedTextMessage?.text; console.log(msg); console.log(msg.message.conversation); input = msg.message.conversation; const opening = ["send all", "sendall", "send-all"]; //const res = opening.filter(n=>input.includes(n)); const arr = ["6287716494751", "6283144865112"] if (opening.filter(n=>input.includes(n)).length == 1){ for (const x of arr) { //console.log(x) await whatsapp.sendTextMessage({ sessionId: "session001", // session ID to: x, // always add country code (ex: 62) text: "aq lagi uji server robot : ini cuman uji coba loh yaa", // message you want to send }); } } function randomIntFromInterval(min, max) { // min and max included return Math.floor(Math.random() * (max - min + 1) + min); } const rndmain = randomIntFromInterval(0, arr.length-1); console.log(arr[rndmain]) })
No due date set.
This issue currently doesn't have any dependencies.
Deleting a branch is permanent. It CANNOT be undone. Continue?
Module : velixs-md : velixs-md - npm (npmjs.com) https://velixs.com/blog/cara-membuat-whatsapp-bot-untuk-real-pemula
wa auto close sesion setelah tidak ada transaksi chat
module velixs-md guide https://www.npmjs.com/package/velixs-md
msg class
sesion-send message jika terdapat inbox | typing only
sesion-send message jika terdapat inbox array | send to list number
wa boot send with array