wppconnect-team / wa-js

WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web
https://wppconnect.io/wa-js/
Apache License 2.0
327 stars 120 forks source link

Reply to message is not working #2049

Open Souhaibahar opened 5 days ago

Souhaibahar commented 5 days ago

WA-JS Version

3.4.0

WhatsApp Version

2.3000.1014410277-alpha

Browser Version

Latest Chrome

Operation System

Windows 10

Steps to reproduce

private async Task SendMessage(SendRequest request) { try { var encodedMessage = JavaScriptEncoder.Default.Encode(request.Message);

            var options = "{ markIsRead: true }";
            if (request.CreateChat) {
                options = "{ createChat: true }";
            } else if (!string.IsNullOrEmpty(request.ReplyToMessageId)) {
                options = "{ quotedMsg: '_MESSAGE_ID_' }".Replace("_MESSAGE_ID_", request.ReplyToMessageId);
            }

            await Page.EvaluateFunctionAsync(@"async () => { await WPP.chat.sendTextMessage('CONTACT_ID@c.us', '_MESSAGE_', _OPTIONS_) }".Replace("CONTACT_ID", request.Name).Replace("_MESSAGE_", encodedMessage).Replace("_OPTIONS_", options)).ConfigureAwait(false);
            return true;
        } catch (Exception ex) {
            Console.WriteLine(ex.ToString());
            return false;
        }
    }

What is expected?

To the message be sended as a reply ( when quotedMsg isnot null ) but it's not working

What is actually happening?

The message is sended succefully but not as a response

Any additional comments?

No response