How to create a QuotedMessage using JSON ? #215
Answered
by
mamur-rezeki
frmdeveloper
asked this question in
WhatsApp protocol Q&A
-
I tried this type forMess struct {
Jid types.JID `json:"jid"`
Text string `json:"text"`
Image []byte `json:"image"`
QuotedID string `json:"quotedid"`
Quoted struct {
Conversation string `json:"conversation"`
} `json:"quoted"`
}
err = sock.On("sendText", func(h *gosocketio.Channel, args forMess) {
client.SendMessage(args.Jid, "", &waProto.Message{
ExtendedTextMessage: &waProto.ExtendedTextMessage{
Text: proto.String(args.Text),
ContextInfo: &waProto.ContextInfo{
StanzaId: &args.QuotedID,
Participant: proto.String(args.Jid.String()),
QuotedMessage: args.Quoted,
},
},
})
}) And error
|
Beta Was this translation helpful? Give feedback.
Answered by
mamur-rezeki
Jul 31, 2022
Replies: 1 comment 10 replies
-
Your json path should be match with In my code i have to Unmarshaling json to var msg_quote proto.Message
var json_quote = []byte("{...}")
if err := json.Unmarshal(json_quote, &msg_quote); err != nil {
panic(err)
} else {
// send msg_quote message
} |
Beta Was this translation helpful? Give feedback.
10 replies
Answer selected by
frmdeveloper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your json path should be match with
proto.Message
structure (key).In my code i have to Unmarshaling json to
proto.Message
and if no errors on the progress, the message could be used as a quotes message.