botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Passing object to another dialog using cardAction.dialogAction instead of string.

Open jagadeeshmarthy opened this issue 8 years ago • 3 comments

Bot Info

  • App ID: e9fa41b0-6cc5-4061-ae70-d09c04db9090
  • SDK Platform: NodeJs
  • SDK Version: 3.11.0
  • Active Channels: Skype, Messenger
  • Deployment Environment: ngrok

Issue Description

Unable to pass the object to another dialog using button actions like cardAction.dialogAction.

Code Example

var data = {name:"x",number:123}; var card = new builder.HeroCard(session) .title('#title') .text( "test") .images([ builder.CardImage.create(session, imageUrl) ]) .buttons([ builder.CardAction.dialogAction(session, "Book", data , "Book"), builder.CardAction.imBack(session, "Help", "Help")

                            ]);

Reproduction Steps

1. 2. 3.

Expected Behavior

should pass the data object to book dialog as args but it is sending only as string

Actual Results

jagadeeshmarthy avatar Dec 21 '17 05:12 jagadeeshmarthy

The Databags in the session object session.userData session.conversationData seem to be exactly what you need. They are designed to store key/value pairs of data to use throughout your application. Is there a reason you do not want to use those? More info here

JasonSowers avatar Dec 21 '17 16:12 JasonSowers

Closing as no response from user

JasonSowers avatar Jan 03 '18 22:01 JasonSowers

I have the same issue (with Node SDK). 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. They also don't need to be choices. If the user clicks a url button, I may also need to tag that action.

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?

jhaala avatar May 14 '18 06:05 jhaala