why viewoncemessage disappeared #316
Answered
by
frmdeveloper
frmdeveloper
asked this question in
WhatsApp protocol Q&A
-
Code for sendmessagefunc (c *Conn) RelayMessage(jid string, message waProto.Message) (*events.Message, error) {
Jid, _ := types.ParseJID(jid)
send, err := c.Client.SendMessage(context.Background(), Jid, &waProto.Message{
ViewOnceMessage: &waProto.FutureProofMessage{
Message: &message,
},
}, whatsmeow.SendRequestExtra{ID: GenerateMessageID()})
return &events.Message{
Info: types.MessageInfo{
ID: send.ID,
MessageSource: types.MessageSource{
Chat: Jid,
Sender: *c.Client.Store.ID,
IsFromMe: true,
IsGroup: Jid.Server == types.GroupServer,
},
},
Message: &message,
}, err
} I call the function above with the following code:{
"viewOnceMessage": {
"message": {
"messageContextInfo": {
"deviceListMetadata": {},
"deviceListMetadataVersion": 2
},
"buttonsMessage": {
"contentText": "Hi it's button message",
"footerText": "Hello World",
"buttons": [
{
"buttonId": "id1",
"buttonText": {
"displayText": "Button 1"
},
"type": "RESPONSE"
},
{
"buttonId": "id2",
"buttonText": {
"displayText": "Button 2"
},
"type": "RESPONSE"
},
{
"buttonId": "id3",
"buttonText": {
"displayText": "Button 3"
},
"type": "RESPONSE"
}
],
"headerType": "EMPTY"
}
}
}
} var wamsg waProto.Message
json.Unmarshal([]byte("json above"), &wamsg)
res,_ := c.RelayMessage(m.From.String(), wamsg)
json.MarshalIndent(res, "", " ") Result:"viewOnceMessage" disappeared{
"Info": {
"Chat": "62xx-1635871676@g.us",
"Sender": "62xx@s.whatsapp.net",
"IsFromMe": true,
"IsGroup": true,
"BroadcastListOwner": "",
"ID": "C6E072594DFD53673179D0148B6C0FRM",
"Type": "",
"PushName": "",
"Timestamp": "0001-01-01T00:00:00Z",
"Category": "",
"Multicast": false,
"MediaType": "",
"VerifiedName": null,
"DeviceSentMeta": null
},
"Message": {
"buttonsMessage": {
"buttons": [
{
"buttonId": "id1",
"buttonText": {
"displayText": "Button 1"
},
"type": 1
},
{
"buttonId": "id2",
"buttonText": {
"displayText": "Button 2"
},
"type": 1
},
{
"buttonId": "id3",
"buttonText": {
"displayText": "Button 3"
},
"type": 1
}
],
"headerType": 1,
"Header": null
}
},
"IsEphemeral": false,
"IsViewOnce": false,
"IsViewOnceV2": false,
"IsDocumentWithCaption": false,
"IsEdit": false,
"RawMessage": null
} |
Beta Was this translation helpful? Give feedback.
Answered by
frmdeveloper
Jan 5, 2023
Replies: 2 comments 3 replies
Answer selected by
frmdeveloper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SORRY