gabrieldwight / Whatsapp-Business-Cloud-Api-Net

This is C# wrapper of whatsapp business cloud api for .NET
MIT License
284 stars 104 forks source link

"Reply to Message" feature is not marking messages as replies in certain scenarios #71

Closed AmonApolonio closed 3 months ago

AmonApolonio commented 4 months ago

When replying to a message, the message is sent but not marked as replying (with some exceptions) The feature "reply to message" doesn't work when the system is replying to a message the user sent, but is working when:

  1. Replying to a message the user sent replying to other message
  2. Replying to a message the system sent

issue_whatsapp_reply

To Reproduce

        var textMessageReplyRequest = new TextMessageReplyRequest
        {
            Context = new TextMessageContext { MessageId = request.QuotedMessageId },
            To = request.Number,
            Text = new WhatsAppText
            {
                Body = request.Text,
                PreviewUrl = false
            }
        };

        var results = await _whatsAppBusinessClient.SendTextMessageAsync(textMessageReplyRequest, null, cancellationToken);
gabrieldwight commented 4 months ago

the user sending the message to the system it will be identified as a user-initiated conversation on cloud api. To reply to the user-initiated conversation you will need to handle the reply request on the webhook level.

AmonApolonio commented 4 months ago

To clarify further, the _whatsAppBusinessClient.SendTextMessageAsync() plugin function is suitable for replying to messages sent by the system. However, when replying to messages sent by the user, this function will not work. In such cases, I'll need to handle the reply request at the webhook level. Is that correct?

gabrieldwight commented 4 months ago

Yes, correct since the user is initiating the conversation which will make the reply function work when the user sends a message to your system.

AmonApolonio commented 4 months ago

Oh, I managed to make the _whatsAppBusinessClient.SendTextMessageAsync() function work for replying to user messages, by updating the Cloud API version from v18.0 to v19.0. However, only this reply request is functional; the others, like audio/document/contact reply requests, still do not work even after the Cloud API version update. I'm not quite sure why.

gabrieldwight commented 4 months ago

I will check on the changelogs for graph API v19.0 to see what has changed for different message reply requests.