0

How do you handle a postback from the messenger persistent menu in the MS Bot Framework?

I have not been able to see any channel data.

Please can someone tell me how this event is handled.

Mrakulis
  • 91
  • 8

1 Answers1

0

When you click persistent menu you get something like this :

{
  "sender":{
    "id":"USER_ID"
  },
  "recipient":{
    "id":"PAGE_ID"
  },
  "timestamp":1458692752478,
  "message":{
    "mid":"mid.1457764197618:41d102a3e1ae206a38",
    "text":"hello, world!",
    "quick_reply": {
      "payload": "DEVELOPER_DEFINED_PAYLOAD"
    }
  }
}    

More.

You can get it :

string quick_reply = msg.ChannelData != null ? msg.ChannelData.message?.quick_reply?.payload.ToString() : "";

I'm using this line of code to get quick reply, but it's the same code for getting callback from persistent menu because it's quick reply actually.

Bob Swager
  • 884
  • 9
  • 25
  • For some reason, I am not getting any Json back in the channeldata. I am able to handle quick replies usually. I made a model and deserialize it. but i don't get anything at all with the persistent menu. – Mrakulis Jun 09 '17 at 20:33
  • What do you have into incoming message ? – Bob Swager Jun 10 '17 at 08:11
  • I an unable to see anything, I tried to output the channeldata as a message. but nothing displays. how can I check? – Mrakulis Jun 10 '17 at 16:45
  • Download ngrok and make your local address public. Put your generated link as endpoint to your bot framework dashboard. And debug your incoming message. – Bob Swager Jun 11 '17 at 13:33