[Node.js, FB Messenger] Passing objects using cardAction.dialogAction
Bot Info
- SDK Platform: Node.js
- SDK Version: 3.15.0
- Active Channels: Facebook
- Deployment Environment: Azure Bot Service
Issue Description
I have the same problem of a closed unsolved issue (#3961). I need to pass multiple values on click events to set tags for segmenting users, which will then be stored in session.userData. The problem is how to capture the data on click events?
For example, there's 3 buttons attached to a Hero Card. Depending on the button(s) a user selects, different tags and values need to be added/updated in session.userData. It would be very preferable to achieve this at the button level instead of after the user is directed to a dialog. Another example would be url buttons that don't direct to any dialogs. How would I be able to tag that click?
I was hoping to pass an object to catching during the incoming messaging event (or from the waterfall args). However, the only allowed value for the dialogAction data parameter is a string. Trying to use an object just gets converted to a string value, becoming unusable. Could this not be converted to stringified JSON instead, allowing it to be parsed after it's received?
If passing object data isn't possible, how can multiple values be passes & captured on click events?
Yes, multiple values can be passed and captured on click events of a button. Here is an example in c# that uses the Adaptive Cards library: https://github.com/Microsoft/BotBuilder/issues/4587#issuecomment-388221242
Am I understanding correctly that capturing click events is only possible using adaptive cards? I would need to convert all my existing buttons and rich cards into adaptive cards?
I'm not aware of a method to send multiple values without an adaptive card.