You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experiencing an issue with whatsapp-web.js where messages sent using client.sendMessage() are not being retrieved with fetchMessages(). Only messages sent by the user are showing up. However, when I send a message through the real-time browser interface, it appears correctly. Messages sent programmatically are not appearing in the message history fetched by fetchMessages(), whereas messages sent through the WhatsApp Web UI appear as expected.
Expected behavior
Expected Behavior:
The message sent via client.sendMessage() should appear in the results of fetchMessages() along with other messages in the chat history.
Actual Behavior:
The message sent via client.sendMessage() is not included in the results returned by fetchMessages(). Messages sent through the WhatsApp Web UI are shown correctly.
Steps to Reproduce the Bug or Issue
Initialize the whatsapp-web.js client.
Use client.sendMessage(chatId, 'Your message here') to send a message.
Immediately after sending, use chat.fetchMessages({ limit: 10 }) to fetch recent messages from the chat.
Observe that the sent message is not included in the fetched messages.
I don't have such issue, perhaps it's just delay of retrieve messages? Because there is some delay if you send through the API and phone WhatsApp is not synced, do you try with client.on('message_create', async (message) => {}); and check the message is created successfully?
Is there an existing issue for this?
Describe the bug
I am experiencing an issue with whatsapp-web.js where messages sent using client.sendMessage() are not being retrieved with fetchMessages(). Only messages sent by the user are showing up. However, when I send a message through the real-time browser interface, it appears correctly. Messages sent programmatically are not appearing in the message history fetched by fetchMessages(), whereas messages sent through the WhatsApp Web UI appear as expected.
Expected behavior
Expected Behavior:
The message sent via client.sendMessage() should appear in the results of fetchMessages() along with other messages in the chat history.
Actual Behavior:
The message sent via client.sendMessage() is not included in the results returned by fetchMessages(). Messages sent through the WhatsApp Web UI are shown correctly.
Steps to Reproduce the Bug or Issue
Relevant Code
const { Client } = require('whatsapp-web.js');
const client = new Client();
client.on('ready', async () => {
const chatId = '9XXXXXXXXXXXX@c.us'; // Replace with your chat ID
});
client.initialize();
Browser Type
Chromium
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
Operating System: Windows 10
npm/Yarn: npm
whatsapp-web.js Version: [e.g., v1.17.2]
Additional context
No response
The text was updated successfully, but these errors were encountered: