Reputation: 173
I've run in to some issues with suggest buttons in Facebook messenger. When i get the response from the user, i get the Title field back, and the value is lost. This works fine in the bot emulator, but not from Facebook messenger. Here is the code for creating the buttons:
var reply = context.MakeMessage();
reply.Text = "What can i do for you?";
var suggests = new SuggestedActions();
var actions = new List<CardAction>();
foreach (var button in utter.Buttons)
{
actions.Add(new CardAction
{
Title = button.Text,
Type = ActionTypes.ImBack,
Value = button.Payload,
Text = button.Payload,
DisplayText = button.Text
});
}
suggests.Actions = actions;
reply.SuggestedActions = suggests;
return reply;
When a user presses the button, i want the payload back to msbf, but i only get the button title. Could anyone please shed some light on what's happening here?
I'm using Bot Builder version 3.12.2.4
Upvotes: 2
Views: 276
Reputation: 173
This seems to be a bug in the BotBuider SDK. Adding
activity.Text = activity.GetChannelData<dynamic>()?.message?.quick_reply?.payload ?? activity.Text;
in MessagesController.cs resovles the issue.
Solution from this issue on github: https://github.com/Microsoft/BotBuilder/issues/3555
Upvotes: 2