button message not work on mobile android and ios #279
Unanswered
joeengressia
asked this question in
WhatsApp protocol Q&A
Replies: 1 comment 5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
after update library to go.mau.fi/whatsmeow v0.0.0-20221113135643-05e0c80bc669
button message is not work on mobile, but work on whatsapp desktop and whatsapp web.
this is my code
import (
proto "go.mau.fi/whatsmeow/binary/proto"
goProto "google.golang.org/protobuf/proto"
)
var btnOptions []*proto.ButtonsMessage_Button
btnOptions = make([]*proto.ButtonsMessage_Button, len(l.ButtonMessage.ButtonOptions))
for _, rowBtn := range l.ButtonMessage.ButtonOptions {
var protoBtn *proto.ButtonsMessage_Button
protoBtn = &proto.ButtonsMessage_Button{
ButtonId: goProto.String(rowBtn.ButtonId),
ButtonText: &proto.ButtonsMessage_Button_ButtonText{
DisplayText: goProto.String(rowBtn.ButtonText),
},
Type: proto.ButtonsMessage_Button_RESPONSE.Enum(),
}
btnOptions = append(btnOptions, protoBtn)
}
msg := &proto.Message{
ViewOnceMessage: &proto.FutureProofMessage{
Message: &proto.Message{
ButtonsMessage: &proto.ButtonsMessage{
HeaderType: proto.ButtonsMessage_EMPTY.Enum(),
ContentText: goProto.String(l.ButtonMessage.HeaderText),
Buttons: btnOptions,
FooterText: goProto.String(l.ButtonMessage.FooterText),
}, MessageContextInfo: &proto.MessageContextInfo{
DeviceListMetadataVersion: goProto.Int32(2),
DeviceListMetadata: &proto.DeviceListMetadata{},
}}}}
Beta Was this translation helpful? Give feedback.
All reactions