Using WebChat, we are sending CardActions either as SuggestedActions or as HeroCard Buttons.
The issue we are facing is that we can not differentiate between a SuggestedAction pressed or a normal text message. Whenever the SuggestedAction is pressed, we only receive is the "Text" field of that CardAction
When dealing with hero cards we can check if ChannelData has "postBack": true , if so then the "Text" would be the payload but what can we do to get the payload from a SuggestedAction ?
Using Javascript integration of WebChat
https://cdn.botframework.com/botframework-webchat/latest/webchat.js`
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: TokenFetched
}),
styleOptions: {
rootHeight: '100%',
rootWidth: '100%'
},
userID: '1',
username: 'Marc'
},
document.getElementById('webchat')
);
Thank you
@marcasmar94 thanks for filing this issue. Could you please provide your code related to the suggested actions / hero card implementations?
@marcasmar94 I would recommend using a messageBack action instead of a postBack. It includes the action's value property where you can indicate how the activity was sent. Take a look at the code snippets below.
Bot Framework SDK v4 (Node)
this.onMessage(async (context, next) => {
await context.sendActivity({
text: 'Please select one of the actions below',
suggestedActions: {
actions: [
{
displayText: 'say Hello World!',
title: 'Message back as JSON with display text',
text: 'Some text',
type: 'messageBack',
value: {
sentFromAction: true
},
}
]
}
});
Response

Thank you @tdurnford , using messageBack got the desired result. 馃憤