pak kacung Posted June 30 Posted June 30 On 6/28/2024 at 5:54 PM, wahyou said: @pak kacung di android bisa bro Iya....punya saya juga sudah bisa...apakah sudah bisa kirim list message via app scrip google? On 6/28/2024 at 5:54 PM, wahyou said: @pak kacung di android bisa bro Iya....punya saya juga sudah bisa...apakah sudah bisa kirim list message via app scrip google? Quote
pak kacung Posted June 30 Posted June 30 3 hours ago, The Billionaire said: is this android??? Iya betul demo disini +62 815-5955-4823 Quote
The Billionaire Posted June 30 Posted June 30 Please who knows a trick I can use to send broadcast messages to 3k numbers without being banned ????? Quote
DW Members Magd Almuntaser Posted June 30 Author DW Members Posted June 30 (edited) 16 hours ago, The Billionaire said: Please who knows a trick I can use to send broadcast messages to 3k numbers without being banned ????? you can but not 3k numbers .. only 255 every broadcast .. you need to change some files to able to send to brodcast .. whatsapp gateway script use lib (WhiskeySockets/Baileys) that can login, send msg .. etc so you can go to here: github_com/WhiskeySockets/Baileys/pull/249 i've decoded (server/whatsapp.js) file for you so you can change anything you want (Only for v7.0.0): /**************************/ /* Nulled & Decoded */ /* By Magd Almuntaser */ /* TTMTT */ /* 7.0.0 */ /**************************/ const { Boom } = require('@hapi/boom') const { default: makeWASocket, Browsers, fetchLatestBaileysVersion, useMultiFileAuthState, makeCacheableSignalKeyStore, DisconnectReason, } = require('@whiskeysockets/baileys') const QRCode = require('qrcode'), fs = require('fs') let sock = [], qrcode = [], pairingCode = [], intervalStore = [] const { setStatus } = require('./database/index'), { IncomingMessage } = require('./controllers/incomingMessage'), { formatReceipt, getSavedPhoneNumber, prepareMediaMessage, } = require('./lib/helper'), MAIN_LOGGER = require('./lib/pino'), NodeCache = require('node-cache'), logger = MAIN_LOGGER.child({}), msgRetryCounterCache = new NodeCache(), connectToWhatsApp = async ( token, ev = null, auth = false ) => { if (typeof qrcode[token] !== 'undefined' && !auth) { return ( ev?.emit('qrcode', { token: token, data: qrcode[token], message: 'please scan with your Whatsapp Accountt', }), { status: false, sock: sock[token], qrcode: qrcode[token], message: 'please scan', } ) } if (typeof pairingCode[token] !== 'undefined' && auth) { return ( ev?.emit('code', { token: token, data: pairingCode[token], message: 'Go to whatsapp -> link device -> link with phone number, and pairing with this code.', }), { status: false, code: pairingCode[token], message: 'pairing with that code', } ) } try { let phoneNum = sock[token].user.id.split(':') phoneNum = phoneNum[0] + '@s.whatsapp.net' const ppUrl = await getPpUrl(token, phoneNum) return ( ev?.emit('connection-open', { token: token, user: sock[token].user, ppUrl: ppUrl, }), delete qrcode[token], delete pairingCode[token], { status: true, message: 'Already connected', } ) } catch (error) { ev?.emit('message', { token: token, message: 'Connecting.. (1)..', }) } const { version: version, isLatest: isLatest } = await fetchLatestBaileysVersion() console.log( 'You re using whatsapp gateway M Pedia v6.1.0 - Contact admin if any trouble : 6292298859671' ) console.log('using WA v' + version.join('.') + ', isLatest: ' + isLatest) const { state: state, saveCreds: saveCreds } = await useMultiFileAuthState('./credentials/' + token) sock[token] = makeWASocket({ version: version, browser: Browsers.macOS('Chrome', 'Mpedia'), logger: logger, printQRInTerminal: false, auth: { creds: state.creds, keys: makeCacheableSignalKeyStore(state.keys, logger), }, msgRetryCounterCache: msgRetryCounterCache, generateHighQualityLinkPreview: true, }) if (auth && 'me' in state.creds === false) { const phoneNumber = await getSavedPhoneNumber(token) try { const code = await sock[token].requestPairingCode(phoneNumber) pairingCode[token] = code } catch (error) { ev?.emit('message', { token: token, message: 'Time out, please refresh page', }) } ev?.emit('code', { token: token, data: pairingCode[token], message: 'Go to whatsapp -> link device -> link with phone number, and pairing with this code.', }) } return ( sock[token].ev.process(async (events) => { if (events['connection.update']) { const update = events['connection.update'], { connection: connection, lastDisconnect: lastDisconnect, qr: qr, } = update if (connection === 'close') { const proto = lastDisconnect.error?.output?.payload?.message, msgs = lastDisconnect.error?.output?.payload?.error if ( (lastDisconnect?.error instanceof Boom)?.output?.statusCode !== DisconnectReason.loggedOut ) { delete qrcode[token] ev?.emit('message', { token: token, message: 'Connecting..', }) if (proto == 'QR refs attempts ended') { sock[token].ws.close() delete qrcode[token] delete pairingCode[token] delete sock[token] ev?.emit('message', { token: token, message: 'Request QR ended. reload web to scan again', }) return } ;(msgs === 'Unauthorized' || msgs === 'Method Not Allowed') && (setStatus(token, 'Disconnect'), clearConnection(token), connectToWhatsApp(token, ev)) proto === 'Stream Errored (restart required)' && connectToWhatsApp(token, ev) proto === 'Connection was lost' && delete sock[token] } else { setStatus(token, 'Disconnect') console.log('Connection closed. You are logged out.') ev?.emit('message', { token: token, message: 'Connection closed. You are logged out.', }) clearConnection(token) connectToWhatsApp(token, ev) } } qr && (console.log('new qr', token), QRCode.toDataURL(qr, function (resMsg, qrCode) { if (resMsg) { console.log(resMsg) } qrcode[token] = qrCode connectToWhatsApp(token, ev, auth) })) if (connection === 'open') { console.log('OPEN OPEN OPEN') setStatus(token, 'Connected') delete qrcode[token] delete pairingCode[token] let PhoneNums = sock[token].user.id.split(':') PhoneNums = PhoneNums[0] + '@s.whatsapp.net' const ppUrl = await getPpUrl(token, PhoneNums) ev?.emit('connection-open', { token: token, user: sock[token].user, ppUrl: ppUrl, }) delete qrcode[token] delete pairingCode[token] } } if (events['creds.update']) { const updateCreds = events['creds.update'] saveCreds(updateCreds) } if (events['messages.upsert']) { const msgUpsert = events['messages.upsert'] IncomingMessage(msgUpsert, sock[token]) } }), { sock: sock[token], qrcode: qrcode[token], } ) } async function connectWaBeforeSend(connTo) { let undConn = undefined, connWa connWa = await connectToWhatsApp(connTo) await connWa.sock.ev.on('connection.update', (qrtoken) => { const { connection: connection, qr: qr } = qrtoken connection === 'open' && (undConn = true) qr && (undConn = false) }) let i = 0 while (typeof undConn === 'undefined') { i++ if (i > 4) { break } await new Promise((resolve) => setTimeout(resolve, 1000)) } return undConn } const sendText = async (token, format, tests) => { try { const conn = await sock[token].sendMessage( formatReceipt(format), { text: tests } ) return conn } catch (error) { return false } }, sendMessage = async (token, format, jsonString) => { try { const conn = await sock[token].sendMessage( formatReceipt(format), JSON.parse(jsonString) ) return conn } catch (error) { return false } } async function sendMedia( token, format, type, url, caption, options, fileName ) { const id = formatReceipt(format) let Jid = sock[token].user.id.replace(/:\d+/, '') if (type == 'audio') { return await sock[token].sendMessage(id, { audio: { url: url }, ptt: true, mimetype: 'audio/mpeg', }) } const resPrep = await prepareMediaMessage(sock[token], { caption: caption ? caption : '', fileName: fileName, media: url, mediatype: type !== 'video' && type !== 'image' ? 'document' : type, }), message = { ...resPrep.message } return await sock[token].sendMessage(id, { forward: { key: { remoteJid: Jid, fromMe: true, }, message: message, }, }) } async function sendButtonMessage( token, format, list, caption, footer, url ) { let type = 'url' try { const buttons = list.map((string, buttonId) => { return { buttonId: buttonId, buttonText: { displayText: string.displayText }, type: 1, } }) if (url) { var isimg = { image: type == 'url' ? { url: url } : fs.readFileSync('src/public/temp/' + url), caption: caption, footer: footer, buttons: buttons, headerType: 4, viewOnce: true, } } else { var isimg = { text: caption, footer: footer, buttons: buttons, headerType: 1, viewOnce: true, } } const sendMs = await sock[token].sendMessage( formatReceipt(format), isimg ) return sendMs } catch (error) { return console.log(error), false } } async function sendTemplateMessage( token, format, templateButtons, caption, footer, url ) { try { if (url) { var types = { caption: caption, footer: footer, viewOnce: true, templateButtons: templateButtons, image: { url: url }, viewOnce: true, } } else { var types = { text: caption, footer: footer, viewOnce: true, templateButtons: templateButtons, } } const resSendMsg = await sock[token].sendMessage( formatReceipt(format), types ) return resSendMsg } catch (error) { return console.log(error), false } } async function sendListMessage( token, format, sections, texts, footer, title, buttonText ) { try { const Lists = { text: texts, footer: footer, title: title, buttonText: buttonText, sections: [sections], }, resSendMsg = await sock[token].sendMessage( formatReceipt(format), Lists, { ephemeralExpiration: 604800 } ) return resSendMsg } catch (error) { return console.log(error), false } } async function sendPollMessage( token, format, name, values, selectableCount ) { try { const ResSendMsg = await sock[token].sendMessage( formatReceipt(format), { poll: { name: name, values: values, selectableCount: selectableCount, }, } ) return ResSendMsg } catch (error) { return console.log(error), false } } async function fetchGroups(token) { try { let GetAll = await sock[token].groupFetchAllParticipating(), ResGet = Object.entries(GetAll) .slice(0) .map((MapGroup) => MapGroup[1]) return ResGet } catch (error) { return false } } async function isExist(token, PhoneNum) { try { if (typeof sock[token] === 'undefined') { const ConnBe = await connectWaBeforeSend(token) if (!ConnBe) { return false } } if (PhoneNum.includes('@g.us')) { return true } else { const [isNum] = await sock[token].onWhatsApp('+' + PhoneNum) return PhoneNum.length > 11 ? isNum : true } } catch (error) { return false } } async function getPpUrl(token, string, type) { let imgPp try { return ( (imgPp = await sock[token].profilePictureUrl(string)), imgPp ) } catch (error) { return 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png' } } async function deleteCredentials(token, evs = null) { evs !== null && evs.emit('message', { token: token, message: 'Logout Progres..', }) try { if (typeof sock[token] === 'undefined') { const ConnWaBe = await connectWaBeforeSend(token) ConnWaBe && (sock[token].logout(), delete sock[token]) } else { sock[token].logout() delete sock[token] } return ( delete qrcode[token], clearInterval(intervalStore[token]), setStatus(token, 'Disconnect'), evs != null && (evs.emit('Unauthorized', token), evs.emit('message', { token: token, message: 'Connection closed. You are logged out.', })), fs.existsSync('./credentials/' + token) && fs.rmSync( './credentials/' + token, { recursive: true, force: true, }, (debug) => { if (debug) { console.log(debug) } } ), { status: true, message: 'Deleting session and credential', } ) } catch (error) { return ( console.log(error), { status: true, message: 'Nothing deleted', } ) } } function clearConnection(token) { clearInterval(intervalStore[token]) delete sock[token] delete qrcode[token] setStatus(token, 'Disconnect') fs.existsSync('./credentials/' + token) && (fs.rmSync( './credentials/' + token, { recursive: true, force: true, }, (debug) => { if (debug) { console.log(debug) } } ), console.log('credentials/' + token + ' is deleted')) } async function initialize(filetoken, result) { const { token: token } = filetoken.body if (token) { const readFileSync = require('fs'), path = './credentials/' + token if (readFileSync.existsSync(path)) { sock[token] = undefined const resultBefore = await connectWaBeforeSend(token) return resultBefore ? result.status(200).json({ status: true, message: token + ' connection restored', }) : result.status(200).json({ status: false, message: token + ' connection failed', }) } return result.send({ status: false, message: token + ' Connection failed,please scan first', }) } return result.send({ status: false, message: 'Wrong Parameterss', }) } module.exports = { connectToWhatsApp: connectToWhatsApp, sendText: sendText, sendMedia: sendMedia, sendButtonMessage: sendButtonMessage, sendTemplateMessage: sendTemplateMessage, sendListMessage: sendListMessage, sendPollMessage: sendPollMessage, isExist: isExist, getPpUrl: getPpUrl, fetchGroups: fetchGroups, deleteCredentials: deleteCredentials, sendMessage: sendMessage, initialize: initialize, connectWaBeforeSend: connectWaBeforeSend, sock: sock, } whatsapp.js Edited July 1 by Magd Almuntaser 1 1 Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
pak kacung Posted July 1 Posted July 1 6 hours ago, Magd Almuntaser said: you can but not 3k numbers .. only 255 every broadcast .. you need to change some files to able to send to brodcast .. whatsapp gateway script use lib (WhiskeySockets/Baileys) that can login, send msg .. etc so you can go to here: github_com/WhiskeySockets/Baileys/pull/249 i've decoded (server/whatsapp.js) file for you so you can change anything you want: /**************************/ /* Nulled & Decoded */ /* By Magd Almuntaser */ /* TTMTT */ /**************************/ const { Boom } = require('@hapi/boom') const { default: makeWASocket, Browsers, fetchLatestBaileysVersion, useMultiFileAuthState, makeCacheableSignalKeyStore, DisconnectReason, } = require('@whiskeysockets/baileys') const QRCode = require('qrcode'), fs = require('fs') let sock = [], qrcode = [], pairingCode = [], intervalStore = [] const { setStatus } = require('./database/index'), { IncomingMessage } = require('./controllers/incomingMessage'), { formatReceipt, getSavedPhoneNumber, prepareMediaMessage, } = require('./lib/helper'), MAIN_LOGGER = require('./lib/pino'), NodeCache = require('node-cache'), logger = MAIN_LOGGER.child({}), msgRetryCounterCache = new NodeCache(), connectToWhatsApp = async ( token, ev = null, auth = false ) => { if (typeof qrcode[token] !== 'undefined' && !auth) { return ( ev?.emit('qrcode', { token: token, data: qrcode[token], message: 'please scan with your Whatsapp Accountt', }), { status: false, sock: sock[token], qrcode: qrcode[token], message: 'please scan', } ) } if (typeof pairingCode[token] !== 'undefined' && auth) { return ( ev?.emit('code', { token: token, data: pairingCode[token], message: 'Go to whatsapp -> link device -> link with phone number, and pairing with this code.', }), { status: false, code: pairingCode[token], message: 'pairing with that code', } ) } try { let phoneNum = sock[token].user.id.split(':') phoneNum = phoneNum[0] + '@s.whatsapp.net' const ppUrl = await getPpUrl(token, phoneNum) return ( ev?.emit('connection-open', { token: token, user: sock[token].user, ppUrl: ppUrl, }), delete qrcode[token], delete pairingCode[token], { status: true, message: 'Already connected', } ) } catch (error) { ev?.emit('message', { token: token, message: 'Connecting.. (1)..', }) } const { version: version, isLatest: isLatest } = await fetchLatestBaileysVersion() console.log( 'You re using whatsapp gateway M Pedia v6.1.0 - Contact admin if any trouble : 6292298859671' ) console.log('using WA v' + version.join('.') + ', isLatest: ' + isLatest) const { state: state, saveCreds: saveCreds } = await useMultiFileAuthState('./credentials/' + token) sock[token] = makeWASocket({ version: version, browser: Browsers.macOS('Chrome', 'Mpedia'), logger: logger, printQRInTerminal: false, auth: { creds: state.creds, keys: makeCacheableSignalKeyStore(state.keys, logger), }, msgRetryCounterCache: msgRetryCounterCache, generateHighQualityLinkPreview: true, }) if (auth && 'me' in state.creds === false) { const phoneNumber = await getSavedPhoneNumber(token) try { const code = await sock[token].requestPairingCode(phoneNumber) pairingCode[token] = code } catch (error) { ev?.emit('message', { token: token, message: 'Time out, please refresh page', }) } ev?.emit('code', { token: token, data: pairingCode[token], message: 'Go to whatsapp -> link device -> link with phone number, and pairing with this code.', }) } return ( sock[token].ev.process(async (events) => { if (events['connection.update']) { const update = events['connection.update'], { connection: connection, lastDisconnect: lastDisconnect, qr: qr, } = update if (connection === 'close') { const proto = lastDisconnect.error?.output?.payload?.message, msgs = lastDisconnect.error?.output?.payload?.error if ( (lastDisconnect?.error instanceof Boom)?.output?.statusCode !== DisconnectReason.loggedOut ) { delete qrcode[token] ev?.emit('message', { token: token, message: 'Connecting..', }) if (proto == 'QR refs attempts ended') { sock[token].ws.close() delete qrcode[token] delete pairingCode[token] delete sock[token] ev?.emit('message', { token: token, message: 'Request QR ended. reload web to scan again', }) return } ;(msgs === 'Unauthorized' || msgs === 'Method Not Allowed') && (setStatus(token, 'Disconnect'), clearConnection(token), connectToWhatsApp(token, ev)) proto === 'Stream Errored (restart required)' && connectToWhatsApp(token, ev) proto === 'Connection was lost' && delete sock[token] } else { setStatus(token, 'Disconnect') console.log('Connection closed. You are logged out.') ev?.emit('message', { token: token, message: 'Connection closed. You are logged out.', }) clearConnection(token) connectToWhatsApp(token, ev) } } qr && (console.log('new qr', token), QRCode.toDataURL(qr, function (resMsg, qrCode) { if (resMsg) { console.log(resMsg) } qrcode[token] = qrCode connectToWhatsApp(token, ev, auth) })) if (connection === 'open') { console.log('OPEN OPEN OPEN') setStatus(token, 'Connected') delete qrcode[token] delete pairingCode[token] let PhoneNums = sock[token].user.id.split(':') PhoneNums = PhoneNums[0] + '@s.whatsapp.net' const ppUrl = await getPpUrl(token, PhoneNums) ev?.emit('connection-open', { token: token, user: sock[token].user, ppUrl: ppUrl, }) delete qrcode[token] delete pairingCode[token] } } if (events['creds.update']) { const updateCreds = events['creds.update'] saveCreds(updateCreds) } if (events['messages.upsert']) { const msgUpsert = events['messages.upsert'] IncomingMessage(msgUpsert, sock[token]) } }), { sock: sock[token], qrcode: qrcode[token], } ) } async function connectWaBeforeSend(connTo) { let undConn = undefined, connWa connWa = await connectToWhatsApp(connTo) await connWa.sock.ev.on('connection.update', (qrtoken) => { const { connection: connection, qr: qr } = qrtoken connection === 'open' && (undConn = true) qr && (undConn = false) }) let i = 0 while (typeof undConn === 'undefined') { i++ if (i > 4) { break } await new Promise((resolve) => setTimeout(resolve, 1000)) } return undConn } const sendText = async (token, format, tests) => { try { const conn = await sock[token].sendMessage( formatReceipt(format), { text: tests } ) return conn } catch (error) { return false } }, sendMessage = async (token, format, jsonString) => { try { const conn = await sock[token].sendMessage( formatReceipt(format), JSON.parse(jsonString) ) return conn } catch (error) { return false } } async function sendMedia( token, format, type, url, caption, options, fileName ) { const id = formatReceipt(format) let Jid = sock[token].user.id.replace(/:\d+/, '') if (type == 'audio') { return await sock[token].sendMessage(id, { audio: { url: url }, ptt: true, mimetype: 'audio/mpeg', }) } const resPrep = await prepareMediaMessage(sock[token], { caption: caption ? caption : '', fileName: fileName, media: url, mediatype: type !== 'video' && type !== 'image' ? 'document' : type, }), message = { ...resPrep.message } return await sock[token].sendMessage(id, { forward: { key: { remoteJid: Jid, fromMe: true, }, message: message, }, }) } async function sendButtonMessage( token, format, list, caption, footer, url ) { let type = 'url' try { const buttons = list.map((string, buttonId) => { return { buttonId: buttonId, buttonText: { displayText: string.displayText }, type: 1, } }) if (url) { var isimg = { image: type == 'url' ? { url: url } : fs.readFileSync('src/public/temp/' + url), caption: caption, footer: footer, buttons: buttons, headerType: 4, viewOnce: true, } } else { var isimg = { text: caption, footer: footer, buttons: buttons, headerType: 1, viewOnce: true, } } const sendMs = await sock[token].sendMessage( formatReceipt(format), isimg ) return sendMs } catch (error) { return console.log(error), false } } async function sendTemplateMessage( token, format, templateButtons, caption, footer, url ) { try { if (url) { var types = { caption: caption, footer: footer, viewOnce: true, templateButtons: templateButtons, image: { url: url }, viewOnce: true, } } else { var types = { text: caption, footer: footer, viewOnce: true, templateButtons: templateButtons, } } const resSendMsg = await sock[token].sendMessage( formatReceipt(format), types ) return resSendMsg } catch (error) { return console.log(error), false } } async function sendListMessage( token, format, sections, texts, footer, title, buttonText ) { try { const Lists = { text: texts, footer: footer, title: title, buttonText: buttonText, sections: [sections], }, resSendMsg = await sock[token].sendMessage( formatReceipt(format), Lists, { ephemeralExpiration: 604800 } ) return resSendMsg } catch (error) { return console.log(error), false } } async function sendPollMessage( token, format, name, values, selectableCount ) { try { const ResSendMsg = await sock[token].sendMessage( formatReceipt(format), { poll: { name: name, values: values, selectableCount: selectableCount, }, } ) return ResSendMsg } catch (error) { return console.log(error), false } } async function fetchGroups(token) { try { let GetAll = await sock[token].groupFetchAllParticipating(), ResGet = Object.entries(GetAll) .slice(0) .map((MapGroup) => MapGroup[1]) return ResGet } catch (error) { return false } } async function isExist(token, PhoneNum) { try { if (typeof sock[token] === 'undefined') { const ConnBe = await connectWaBeforeSend(token) if (!ConnBe) { return false } } if (PhoneNum.includes('@g.us')) { return true } else { const [isNum] = await sock[token].onWhatsApp('+' + PhoneNum) return PhoneNum.length > 11 ? isNum : true } } catch (error) { return false } } async function getPpUrl(token, string, type) { let imgPp try { return ( (imgPp = await sock[token].profilePictureUrl(string)), imgPp ) } catch (error) { return 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png' } } async function deleteCredentials(token, evs = null) { evs !== null && evs.emit('message', { token: token, message: 'Logout Progres..', }) try { if (typeof sock[token] === 'undefined') { const ConnWaBe = await connectWaBeforeSend(token) ConnWaBe && (sock[token].logout(), delete sock[token]) } else { sock[token].logout() delete sock[token] } return ( delete qrcode[token], clearInterval(intervalStore[token]), setStatus(token, 'Disconnect'), evs != null && (evs.emit('Unauthorized', token), evs.emit('message', { token: token, message: 'Connection closed. You are logged out.', })), fs.existsSync('./credentials/' + token) && fs.rmSync( './credentials/' + token, { recursive: true, force: true, }, (debug) => { if (debug) { console.log(debug) } } ), { status: true, message: 'Deleting session and credential', } ) } catch (error) { return ( console.log(error), { status: true, message: 'Nothing deleted', } ) } } function clearConnection(token) { clearInterval(intervalStore[token]) delete sock[token] delete qrcode[token] setStatus(token, 'Disconnect') fs.existsSync('./credentials/' + token) && (fs.rmSync( './credentials/' + token, { recursive: true, force: true, }, (debug) => { if (debug) { console.log(debug) } } ), console.log('credentials/' + token + ' is deleted')) } async function initialize(filetoken, result) { const { token: token } = filetoken.body if (token) { const readFileSync = require('fs'), path = './credentials/' + token if (readFileSync.existsSync(path)) { sock[token] = undefined const resultBefore = await connectWaBeforeSend(token) return resultBefore ? result.status(200).json({ status: true, message: token + ' connection restored', }) : result.status(200).json({ status: false, message: token + ' connection failed', }) } return result.send({ status: false, message: token + ' Connection failed,please scan first', }) } return result.send({ status: false, message: 'Wrong Parameterss', }) } module.exports = { connectToWhatsApp: connectToWhatsApp, sendText: sendText, sendMedia: sendMedia, sendButtonMessage: sendButtonMessage, sendTemplateMessage: sendTemplateMessage, sendListMessage: sendListMessage, sendPollMessage: sendPollMessage, isExist: isExist, getPpUrl: getPpUrl, fetchGroups: fetchGroups, deleteCredentials: deleteCredentials, sendMessage: sendMessage, initialize: initialize, connectWaBeforeSend: connectWaBeforeSend, sock: sock, } whatsapp.js 15.54 kB · 3 downloads ini di replace di whatsapp.js yang ada di folder server ya? Quote
The Billionaire Posted July 1 Posted July 1 11 hours ago, Magd Almuntaser said: you can but not 3k numbers .. only 255 every broadcast .. you need to change some files to able to send to brodcast .. whatsapp gateway script use lib (WhiskeySockets/Baileys) that can login, send msg .. etc so you can go to here: github_com/WhiskeySockets/Baileys/pull/249 i've decoded (server/whatsapp.js) file for you so you can change anything you want: /**************************/ /* Nulled & Decoded */ /* By Magd Almuntaser */ /* TTMTT */ /**************************/ const { Boom } = require('@hapi/boom') const { default: makeWASocket, Browsers, fetchLatestBaileysVersion, useMultiFileAuthState, makeCacheableSignalKeyStore, DisconnectReason, } = require('@whiskeysockets/baileys') const QRCode = require('qrcode'), fs = require('fs') let sock = [], qrcode = [], pairingCode = [], intervalStore = [] const { setStatus } = require('./database/index'), { IncomingMessage } = require('./controllers/incomingMessage'), { formatReceipt, getSavedPhoneNumber, prepareMediaMessage, } = require('./lib/helper'), MAIN_LOGGER = require('./lib/pino'), NodeCache = require('node-cache'), logger = MAIN_LOGGER.child({}), msgRetryCounterCache = new NodeCache(), connectToWhatsApp = async ( token, ev = null, auth = false ) => { if (typeof qrcode[token] !== 'undefined' && !auth) { return ( ev?.emit('qrcode', { token: token, data: qrcode[token], message: 'please scan with your Whatsapp Accountt', }), { status: false, sock: sock[token], qrcode: qrcode[token], message: 'please scan', } ) } if (typeof pairingCode[token] !== 'undefined' && auth) { return ( ev?.emit('code', { token: token, data: pairingCode[token], message: 'Go to whatsapp -> link device -> link with phone number, and pairing with this code.', }), { status: false, code: pairingCode[token], message: 'pairing with that code', } ) } try { let phoneNum = sock[token].user.id.split(':') phoneNum = phoneNum[0] + '@s.whatsapp.net' const ppUrl = await getPpUrl(token, phoneNum) return ( ev?.emit('connection-open', { token: token, user: sock[token].user, ppUrl: ppUrl, }), delete qrcode[token], delete pairingCode[token], { status: true, message: 'Already connected', } ) } catch (error) { ev?.emit('message', { token: token, message: 'Connecting.. (1)..', }) } const { version: version, isLatest: isLatest } = await fetchLatestBaileysVersion() console.log( 'You re using whatsapp gateway M Pedia v6.1.0 - Contact admin if any trouble : 6292298859671' ) console.log('using WA v' + version.join('.') + ', isLatest: ' + isLatest) const { state: state, saveCreds: saveCreds } = await useMultiFileAuthState('./credentials/' + token) sock[token] = makeWASocket({ version: version, browser: Browsers.macOS('Chrome', 'Mpedia'), logger: logger, printQRInTerminal: false, auth: { creds: state.creds, keys: makeCacheableSignalKeyStore(state.keys, logger), }, msgRetryCounterCache: msgRetryCounterCache, generateHighQualityLinkPreview: true, }) if (auth && 'me' in state.creds === false) { const phoneNumber = await getSavedPhoneNumber(token) try { const code = await sock[token].requestPairingCode(phoneNumber) pairingCode[token] = code } catch (error) { ev?.emit('message', { token: token, message: 'Time out, please refresh page', }) } ev?.emit('code', { token: token, data: pairingCode[token], message: 'Go to whatsapp -> link device -> link with phone number, and pairing with this code.', }) } return ( sock[token].ev.process(async (events) => { if (events['connection.update']) { const update = events['connection.update'], { connection: connection, lastDisconnect: lastDisconnect, qr: qr, } = update if (connection === 'close') { const proto = lastDisconnect.error?.output?.payload?.message, msgs = lastDisconnect.error?.output?.payload?.error if ( (lastDisconnect?.error instanceof Boom)?.output?.statusCode !== DisconnectReason.loggedOut ) { delete qrcode[token] ev?.emit('message', { token: token, message: 'Connecting..', }) if (proto == 'QR refs attempts ended') { sock[token].ws.close() delete qrcode[token] delete pairingCode[token] delete sock[token] ev?.emit('message', { token: token, message: 'Request QR ended. reload web to scan again', }) return } ;(msgs === 'Unauthorized' || msgs === 'Method Not Allowed') && (setStatus(token, 'Disconnect'), clearConnection(token), connectToWhatsApp(token, ev)) proto === 'Stream Errored (restart required)' && connectToWhatsApp(token, ev) proto === 'Connection was lost' && delete sock[token] } else { setStatus(token, 'Disconnect') console.log('Connection closed. You are logged out.') ev?.emit('message', { token: token, message: 'Connection closed. You are logged out.', }) clearConnection(token) connectToWhatsApp(token, ev) } } qr && (console.log('new qr', token), QRCode.toDataURL(qr, function (resMsg, qrCode) { if (resMsg) { console.log(resMsg) } qrcode[token] = qrCode connectToWhatsApp(token, ev, auth) })) if (connection === 'open') { console.log('OPEN OPEN OPEN') setStatus(token, 'Connected') delete qrcode[token] delete pairingCode[token] let PhoneNums = sock[token].user.id.split(':') PhoneNums = PhoneNums[0] + '@s.whatsapp.net' const ppUrl = await getPpUrl(token, PhoneNums) ev?.emit('connection-open', { token: token, user: sock[token].user, ppUrl: ppUrl, }) delete qrcode[token] delete pairingCode[token] } } if (events['creds.update']) { const updateCreds = events['creds.update'] saveCreds(updateCreds) } if (events['messages.upsert']) { const msgUpsert = events['messages.upsert'] IncomingMessage(msgUpsert, sock[token]) } }), { sock: sock[token], qrcode: qrcode[token], } ) } async function connectWaBeforeSend(connTo) { let undConn = undefined, connWa connWa = await connectToWhatsApp(connTo) await connWa.sock.ev.on('connection.update', (qrtoken) => { const { connection: connection, qr: qr } = qrtoken connection === 'open' && (undConn = true) qr && (undConn = false) }) let i = 0 while (typeof undConn === 'undefined') { i++ if (i > 4) { break } await new Promise((resolve) => setTimeout(resolve, 1000)) } return undConn } const sendText = async (token, format, tests) => { try { const conn = await sock[token].sendMessage( formatReceipt(format), { text: tests } ) return conn } catch (error) { return false } }, sendMessage = async (token, format, jsonString) => { try { const conn = await sock[token].sendMessage( formatReceipt(format), JSON.parse(jsonString) ) return conn } catch (error) { return false } } async function sendMedia( token, format, type, url, caption, options, fileName ) { const id = formatReceipt(format) let Jid = sock[token].user.id.replace(/:\d+/, '') if (type == 'audio') { return await sock[token].sendMessage(id, { audio: { url: url }, ptt: true, mimetype: 'audio/mpeg', }) } const resPrep = await prepareMediaMessage(sock[token], { caption: caption ? caption : '', fileName: fileName, media: url, mediatype: type !== 'video' && type !== 'image' ? 'document' : type, }), message = { ...resPrep.message } return await sock[token].sendMessage(id, { forward: { key: { remoteJid: Jid, fromMe: true, }, message: message, }, }) } async function sendButtonMessage( token, format, list, caption, footer, url ) { let type = 'url' try { const buttons = list.map((string, buttonId) => { return { buttonId: buttonId, buttonText: { displayText: string.displayText }, type: 1, } }) if (url) { var isimg = { image: type == 'url' ? { url: url } : fs.readFileSync('src/public/temp/' + url), caption: caption, footer: footer, buttons: buttons, headerType: 4, viewOnce: true, } } else { var isimg = { text: caption, footer: footer, buttons: buttons, headerType: 1, viewOnce: true, } } const sendMs = await sock[token].sendMessage( formatReceipt(format), isimg ) return sendMs } catch (error) { return console.log(error), false } } async function sendTemplateMessage( token, format, templateButtons, caption, footer, url ) { try { if (url) { var types = { caption: caption, footer: footer, viewOnce: true, templateButtons: templateButtons, image: { url: url }, viewOnce: true, } } else { var types = { text: caption, footer: footer, viewOnce: true, templateButtons: templateButtons, } } const resSendMsg = await sock[token].sendMessage( formatReceipt(format), types ) return resSendMsg } catch (error) { return console.log(error), false } } async function sendListMessage( token, format, sections, texts, footer, title, buttonText ) { try { const Lists = { text: texts, footer: footer, title: title, buttonText: buttonText, sections: [sections], }, resSendMsg = await sock[token].sendMessage( formatReceipt(format), Lists, { ephemeralExpiration: 604800 } ) return resSendMsg } catch (error) { return console.log(error), false } } async function sendPollMessage( token, format, name, values, selectableCount ) { try { const ResSendMsg = await sock[token].sendMessage( formatReceipt(format), { poll: { name: name, values: values, selectableCount: selectableCount, }, } ) return ResSendMsg } catch (error) { return console.log(error), false } } async function fetchGroups(token) { try { let GetAll = await sock[token].groupFetchAllParticipating(), ResGet = Object.entries(GetAll) .slice(0) .map((MapGroup) => MapGroup[1]) return ResGet } catch (error) { return false } } async function isExist(token, PhoneNum) { try { if (typeof sock[token] === 'undefined') { const ConnBe = await connectWaBeforeSend(token) if (!ConnBe) { return false } } if (PhoneNum.includes('@g.us')) { return true } else { const [isNum] = await sock[token].onWhatsApp('+' + PhoneNum) return PhoneNum.length > 11 ? isNum : true } } catch (error) { return false } } async function getPpUrl(token, string, type) { let imgPp try { return ( (imgPp = await sock[token].profilePictureUrl(string)), imgPp ) } catch (error) { return 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png' } } async function deleteCredentials(token, evs = null) { evs !== null && evs.emit('message', { token: token, message: 'Logout Progres..', }) try { if (typeof sock[token] === 'undefined') { const ConnWaBe = await connectWaBeforeSend(token) ConnWaBe && (sock[token].logout(), delete sock[token]) } else { sock[token].logout() delete sock[token] } return ( delete qrcode[token], clearInterval(intervalStore[token]), setStatus(token, 'Disconnect'), evs != null && (evs.emit('Unauthorized', token), evs.emit('message', { token: token, message: 'Connection closed. You are logged out.', })), fs.existsSync('./credentials/' + token) && fs.rmSync( './credentials/' + token, { recursive: true, force: true, }, (debug) => { if (debug) { console.log(debug) } } ), { status: true, message: 'Deleting session and credential', } ) } catch (error) { return ( console.log(error), { status: true, message: 'Nothing deleted', } ) } } function clearConnection(token) { clearInterval(intervalStore[token]) delete sock[token] delete qrcode[token] setStatus(token, 'Disconnect') fs.existsSync('./credentials/' + token) && (fs.rmSync( './credentials/' + token, { recursive: true, force: true, }, (debug) => { if (debug) { console.log(debug) } } ), console.log('credentials/' + token + ' is deleted')) } async function initialize(filetoken, result) { const { token: token } = filetoken.body if (token) { const readFileSync = require('fs'), path = './credentials/' + token if (readFileSync.existsSync(path)) { sock[token] = undefined const resultBefore = await connectWaBeforeSend(token) return resultBefore ? result.status(200).json({ status: true, message: token + ' connection restored', }) : result.status(200).json({ status: false, message: token + ' connection failed', }) } return result.send({ status: false, message: token + ' Connection failed,please scan first', }) } return result.send({ status: false, message: 'Wrong Parameterss', }) } module.exports = { connectToWhatsApp: connectToWhatsApp, sendText: sendText, sendMedia: sendMedia, sendButtonMessage: sendButtonMessage, sendTemplateMessage: sendTemplateMessage, sendListMessage: sendListMessage, sendPollMessage: sendPollMessage, isExist: isExist, getPpUrl: getPpUrl, fetchGroups: fetchGroups, deleteCredentials: deleteCredentials, sendMessage: sendMessage, initialize: initialize, connectWaBeforeSend: connectWaBeforeSend, sock: sock, } whatsapp.js 15.54 kB · 5 downloads @Magd Almuntaser I have copied the code and replaced it inside the server/whatsapp.js so what else can I do now ??? Quote
DW Members Magd Almuntaser Posted July 1 Author DW Members Posted July 1 (edited) 5 hours ago, pak kacung said: ini di replace di whatsapp.js yang ada di folder server ya? Ya .. 39 minutes ago, The Billionaire said: @Magd Almuntaser I have copied the code and replaced it inside the server/whatsapp.js so what else can I do now ??? I just decode the file .. But i mean try to get the ID for boradcast so you can send msg to (id@broadcast) becouse WA7 don't have fetch broadcast id so you can change some function to get the broadcast id id=msg_timestamp .. So you need first get the id after that you can send normaly Edited July 1 by Magd Almuntaser 1 Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
agus amin Posted July 1 Posted July 1 4 minutes ago, Magd Almuntaser said: Ya .. I just decode the file .. But i mean try to get the ID for boradcast so you can send msg to (id@broadcast) becouse WA7 don't have fetch broadcast id so you can change some function to get the broadcast id id=msg_timestamp .. So you need first get the id after that you can send normaly Bro decode file js nya, semua file js di encrypt Quote
The Billionaire Posted July 1 Posted July 1 54 minutes ago, Magd Almuntaser said: Ya .. I just decode the file .. But i mean try to get the ID for boradcast so you can send msg to (id@broadcast) becouse WA7 don't have fetch broadcast id so you can change some function to get the broadcast id id=msg_timestamp .. So you need first get the id after that you can send normaly @Magd Almuntaser let me explain my issues hope you will understand, the broadcast is working, just that after it has been sent to 20 numbers from the 3k numbers WhatsApp blocked my line for spamming, although they have released my account, I want a way to prevent it from happening again when I resume the broadcast Quote
DW Members Magd Almuntaser Posted July 1 Author DW Members Posted July 1 4 minutes ago, The Billionaire said: @Magd Almuntaser let me explain my issues hope you will understand, the broadcast is working, just that after it has been sent to 20 numbers from the 3k numbers WhatsApp blocked my line for spamming, although they have released my account, I want a way to prevent it from happening again when I resume the broadcast If you send a broadcast, you won't be blocked. That's what surprised me. Are you sure you used (status@broadcast) when you sent it? Or did you just loop the numbers and send? Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
DW Members Magd Almuntaser Posted July 1 Author DW Members Posted July 1 (edited) I have Decoded the JS files. You can download them from the attachments Extract the compressed file to the script path Only For Version v7.0.0 Decoded_JS_File.zip Edited July 1 by Magd Almuntaser 1 1 1 Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
DW Members Magd Almuntaser Posted July 1 Author DW Members Posted July 1 @agus amin @bloserda @The Billionaire 1 2 Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
agus amin Posted July 1 Posted July 1 55 minutes ago, Magd Almuntaser said: @agus amin @bloserda @The Billionaire Thank's sir Quote
The Billionaire Posted July 1 Posted July 1 2 hours ago, Magd Almuntaser said: I have Decoded the JS files. You can download them from the attachments Extract the compressed file to the script path Decoded_JS_File.zip 13.04 kB · 2 downloads @Magd Almuntaser I am sorry I made a mistake is the Campaign not a Broadcast message, so when I send Campaign to a 3k number I get banned, is there a way to scale through it Quote
DW Members Magd Almuntaser Posted July 1 Author DW Members Posted July 1 5 hours ago, The Billionaire said: @Magd Almuntaser I am sorry I made a mistake is the Campaign not a Broadcast message, so when I send Campaign to a 3k number I get banned, is there a way to scale through it I think campaign use loop numbers that mean send every number alone so you will get block .. But maybe you can use (sleep) function every 15 numbers .. Or use broadcast .. Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
MarCoVar01 Posted July 2 Posted July 2 On 7/1/2024 at 9:19 AM, The Billionaire said: @Magd Almuntaser I am sorry I made a mistake is the Campaign not a Broadcast message, so when I send Campaign to a 3k number I get banned, is there a way to scale through it @The Billionaire What I do is in the campaign option that says delivery time between each message, I put it as a minimum of 10 to 15 seconds to try to prevent WhatsApp from taking it as spam, remember that there is also the possibility that if users They report that it happens faster Quote
pak kacung Posted July 2 Posted July 2 Bagaimana mengatasi yang tiba tiba device tidak koneksi, padahal pada webnya masih ada tanda konek? Quote
Gusik Prasetyo Posted July 3 Posted July 3 23 hours ago, pak kacung said: Bagaimana mengatasi yang tiba tiba device tidak koneksi, padahal pada webnya masih ada tanda konek? I think the problem from your hosting/vps. Menggunakan vps/hosting dari mana bang? Punyaku juga, setelah pindah hosting lancar. Quote
pak kacung Posted July 3 Posted July 3 @Gusik Prasetyo saya menggunakan hosting... Punyamu gak pernah diskonek ya? Quote
Gusik Prasetyo Posted July 4 Posted July 4 4 hours ago, pak kacung said: @Gusik Prasetyo saya menggunakan hosting... Punyamu gak pernah diskonek ya? Dalam seminggu ini lancar saja bang. Jadi meski tidak buka MPWA tetap terkoneksi. You can see my screenshot. Quote
Putra Pertama Posted July 4 Posted July 4 (edited) @Magd Almuntaser On 7/1/2024 at 6:12 PM, Magd Almuntaser said: I have Decoded the JS files. You can download them from the attachments Extract the compressed file to the script path Only For Version v7.0.0 Decoded_JS_File.zip 13.04 kB · 24 downloads help please, on campaign and autoreply not work ReferenceError: Cannot access 'inProgress' before initialization at sendBlastMessage (/home/waswupn/subdomain/waswupn.com/server/controllers/blast.js:40:3) at Layer.handle [as handle_request] (/home/waswupn/nodevenv/subdomain/waswupn.com/16/lib/node_modules/express/lib/router/layer.js:95:5) at next (/home/waswupn/nodevenv/subdomain/waswupn.com/16/lib/node_modules/express/lib/router/route.js:149:13) at checkConnectionBeforeBlast (/home/waswupn/subdomain/waswupn.com/server/lib/middleware.js:34:5) Edited July 4 by Putra Pertama Quote
Putra Pertama Posted July 4 Posted July 4 On 6/27/2024 at 2:31 PM, Magd Almuntaser said: Whatsapp Gateway | Multi Device v7.0.0 NULLED & DECODED Nulled & Decoded By Magd Almuntaser (TTMTT) Hidden content: https://workupload.com/file/f4U5cJ8GC5H autoreply not work. I tried text message, but not work Quote
pak kacung Posted July 4 Posted July 4 2 hours ago, Gusik Prasetyo said: Dalam seminggu ini lancar saja bang. Jadi meski tidak buka MPWA tetap terkoneksi. You can see my screenshot. Sewa hostingnya mahal gak bang? Quote
DW Members Magd Almuntaser Posted July 4 Author DW Members Posted July 4 7 hours ago, pak kacung said: @Gusik Prasetyo saya menggunakan hosting... Punyamu gak pernah diskonek ya? If you have vps you can install PM2 and start node with pm2 .. 1 hour ago, Putra Pertama said: @Magd Almuntaser help please, on campaign and autoreply not work ReferenceError: Cannot access 'inProgress' before initialization at sendBlastMessage (/home/waswupn/subdomain/waswupn.com/server/controllers/blast.js:40:3) at Layer.handle [as handle_request] (/home/waswupn/nodevenv/subdomain/waswupn.com/16/lib/node_modules/express/lib/router/layer.js:95:5) at next (/home/waswupn/nodevenv/subdomain/waswupn.com/16/lib/node_modules/express/lib/router/route.js:149:13) at checkConnectionBeforeBlast (/home/waswupn/subdomain/waswupn.com/server/lib/middleware.js:34:5) I will try to fix it .. And i see many problems with the owner he forget many things so i will fix it .. Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.