1

Below is a waterfall method which will display a hero card in the first step. In the second step , it will receive the value and begin a dialog based on the selection. However i am facing a issue when tested in teams. Please find the below details

Code :

async serviceRequestTypes(stepContext) {
            const srTypes = stepContext.options;
            console.log('INSIDE SR TYPES');
            const serviceRequestCard = CardFactory.heroCard('Service Requests', 'Please choose the belwo options to create the appropriate service Requests',
                        CardFactory.images(['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg']),
  CardFactory.actions([
                            {
                                type: 'messageBack',
                                title: 'Create Generic Service Request',
                                value: 'Create Generic Service Request'
                            },
                            {
                                type: 'messageBack',
                                title: 'Create Application Service Request',
                                value: 'Create Application Service Request'
                            },
                            {
                                type: 'messageBack',
                                title: 'Create Virtual Desktop Service Request',
                                value: 'Create Virtual Desktop Service Request'
                            }
                        ])
                    );

                    await stepContext.context.sendActivity({ attachments: [serviceRequestCard], attachmentLayout: AttachmentLayoutTypes.carousel });
                    return { status: DialogTurnStatus.waiting };
                }
            }

            async classifySRDialog(stepContext) {
                console.log('INSIDE CLASSIFY SR DIALOG');
                **console.log(stepContext.context.activity.value);
                stepContext.values.classifiedSR = stepContext.context.activity.value;**
                console.log(stepContext.values.classifiedSR);
                if (stepContext.values.classifiedSR === 'Create Generic Service Request') {
                    return await stepContext.beginDialog('createGenericSRDialog');
                } else if (stepContext.values.classifiedSR === 'Create Application Service Request') {
                    console.log('Inside Application SR');
                    return await stepContext.beginDialog('createApplicationDialog');
                } else if (stepContext.values.classifiedSR === 'Create Virtual Desktop Service Request') {
                    return await stepContext.beginDialog('createVDIDialog');
                } else {

                }
            }
        }

In the second waterfall method i need to get

stepContext.values.classifiedSR = stepContext.context.activity.value;

This is working absolutely fine in bot emulator and webchat . However when the same is tested using microsoft teams .

stepContext.context.activity.value is coming as {} object. Could any please assist.

Arulvelu
  • 79
  • 1
  • 7

1 Answers1

3

First, and foremost, you should know that ever channel (Teams, Facebook, Web Chat, etc.) handles the data that is passed to it differently (and may have different requirements when doing so, as well). The results that are passed back can and will vary because of this which is why you are seeing different responses between Emulator and Teams.

For Emulator, the value passed in the value property in a hero card, specified as type messageBack or ActionTypes: MessageBack, can be of any type (referenced here).

For Teams, the value passed in must be either a unique identifier or a JSON object (referenced here).

If you adjust your code to send a JSON object, you should get the results you are looking for (in Teams).

Hope of help!

Steven Kanberg
  • 6,078
  • 2
  • 16
  • 35