Title:
/message/edit endpoint silently fails - uses Conversation instead of ExtendedTextMessage
Body:
Bug Description
The POST /message/edit endpoint returns "message": "success" but the message is never actually edited on WhatsApp. The edit is silently ignored.
Root Cause
In pkg/message/service/message_service.go, the EditMessage method builds the edit payload using Conversation:
client.BuildEdit(
recipient,
data.MessageID,
&waE2E.Message{
Conversation: proto.String(data.Message), // <-- bug
})
However, in pkg/sendMessage/service/send_service.go, the SendText method sends messages using ExtendedTextMessage:
msg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: &data.Text,
},
}
Since the original message was sent as ExtendedTextMessage, WhatsApp silently rejects the edit because the message type doesn't match. The WhatsApp protocol requires the edited message to use the same type as the original.
Fix
In pkg/message/service/message_service.go, line ~416, change:
// Before (broken)
&waE2E.Message{
Conversation: proto.String(data.Message),
}
// After (working)
&waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: &data.Message,
},
}
Additional issue
The EditMessage method also has an uninitialized ts variable:
var ts time.Time // never assigned, returns "0001-01-01 00:00:00 +0000 UTC"
This same pattern appears in several other methods (ChatPresence, MarkRead, DeleteMessageEveryone, etc).
How to Reproduce
- Send a text message using
POST /send/text
- Try to edit it using
POST /message/edit with the returned messageId
- Response shows
"message": "success" but the message is NOT edited on WhatsApp
- The response also returns a different
messageId (the edit envelope ID) and a zeroed timestamp
Response example
{
"data": {
"messageId": "3EB028A10887FFA044B3CA", // different from original
"timestamp": "0001-01-01 00:00:00 +0000 UTC" // zero value
},
"message": "success"
}
Environment
- Evolution Go version:
0.6.1-beta
- Docker image:
evoapicloud/evolution-go:latest
Labels (if available)
bug
Title:
/message/editendpoint silently fails - usesConversationinstead ofExtendedTextMessageBody:
Bug Description
The
POST /message/editendpoint returns"message": "success"but the message is never actually edited on WhatsApp. The edit is silently ignored.Root Cause
In
pkg/message/service/message_service.go, theEditMessagemethod builds the edit payload usingConversation:However, in
pkg/sendMessage/service/send_service.go, theSendTextmethod sends messages usingExtendedTextMessage:Since the original message was sent as
ExtendedTextMessage, WhatsApp silently rejects the edit because the message type doesn't match. The WhatsApp protocol requires the edited message to use the same type as the original.Fix
In
pkg/message/service/message_service.go, line ~416, change:Additional issue
The
EditMessagemethod also has an uninitializedtsvariable:This same pattern appears in several other methods (
ChatPresence,MarkRead,DeleteMessageEveryone, etc).How to Reproduce
POST /send/textPOST /message/editwith the returnedmessageId"message": "success"but the message is NOT edited on WhatsAppmessageId(the edit envelope ID) and a zeroedtimestampResponse example
{ "data": { "messageId": "3EB028A10887FFA044B3CA", // different from original "timestamp": "0001-01-01 00:00:00 +0000 UTC" // zero value }, "message": "success" }Environment
0.6.1-betaevoapicloud/evolution-go:latestLabels (if available)
bug