pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.19k stars 3.41k forks source link

Group Messages - "Waiting for this message. This may take a while." #2764

Open gxlpes opened 4 months ago

gxlpes commented 4 months ago

Is there an existing issue for this?

Describe the bug

"After sending messages to groups, this bug starts randomly. Sending messages to individual numbers is working fine, but sending to groups is not working properly.

I always receive the WhatsApp message 'Waiting for this message. This may take a while." after one or two successful messages to groups.

image

Expected behavior

As a user, I expected to send a message and see my sent message in a group.

Steps to Reproduce the Bug or Issue

  1. Send a message in a group (you can see the message)
  2. Close the bot and try to send this message again
  3. The bug started

Relevant Code

const { Client, RemoteAuth } = require("whatsapp-web.js");
const { AwsS3Store } = require("wwebjs-aws-s3");
const { S3Client, PutObjectCommand, HeadObjectCommand, GetObjectCommand, DeleteObjectCommand } = require("@aws-sdk/client-s3");
const qrcode = require("qrcode-terminal");

const s3 = new S3Client({
  region: "sa-east-1",
  credentials: {
    accessKeyId: "123", // mocked
    secretAccessKey: "123", // mocked
  },
});

const putObjectCommand = PutObjectCommand;
const headObjectCommand = HeadObjectCommand;
const getObjectCommand = GetObjectCommand;
const deleteObjectCommand = DeleteObjectCommand;

const store = new AwsS3Store({
  bucketName: "wwebjs-auth",
  remoteDataPath: "wwebjs",
  s3Client: s3,
  putObjectCommand,
  headObjectCommand,
  getObjectCommand,
  deleteObjectCommand,
});

const client = new Client({
  authStrategy: new RemoteAuth({
    clientId: "wwebjs-auth-session",
    dataPath: "./wwebjs_auth",
    store: store,
    backupSyncIntervalMs: 600000,
  }),
});

client.on("qr", (qr) => {
  qrcode.generate(qr, { small: true });
});

client.on("ready", async () => {
  console.log("Client is ready!");
  client.sendPresenceAvailable();
  const msg = await client.sendMessage("123@g.us", "Hey!"); // mocked
  console.log(msg);
});

client.on("remote_session_saved", () => {
  console.log("Saved in remote S3");
});

client.initialize();

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment

OS: Linux Phone OS: Android whatsapp-web.js version: 1.0.2 WhatsApp Web version: 2.2405.4 Node.js Version: 18.14.2

Additional context

No response

alechkos commented 4 months ago

@gxlpes Try to use latest WWeb version, the latest one at the moment is 2.2405.4

gxlpes commented 4 months ago

@gxlpes Try to use latest WWeb version, the latest one at the moment is 2.2405.4

I'm using the lastest version (as shown in my post details) but was still occuring. I also tried to hardcode the version like you said but any progress in my smartphone. The Android version of WhatsApp was is 2.24.2.76 (Android 5, Xiaomi).

My WhatsApp client in Linux is using the version 2.2405.52.

const client = new Client({
  webVersion: "2.2405.4",
  webVersionCache: {
    type: "remote",
    remotePath: "https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2405.4.html",
  },
  authStrategy: new RemoteAuth({
    clientId: "wwebjs-auth-session",
    dataPath: "./wwebjs_auth",
    store: store,
    backupSyncIntervalMs: 600000,
  }),
});

When I first register/login the message works but afterwards the "Waiting for this message" returns.

roigreenberg commented 4 months ago

@gxlpes, have you found a solution? I seem to have the same issue.

I send a message to a few dozen groups, and first, it takes several minutes to arrive, and even when it does, in some groups it shows the "waiting" message for another several minutes.

Nirajan1-droid commented 4 months ago

i think sending them in batches may resolve this problem to some extent.

RAKESHSUVIDYA commented 1 month ago

QR is not working properly in ubuntu platform. Is there anyone who can help

Nirajan1-droid commented 1 month ago

what is the exact problem? describe please.