microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

[Question] How to send hidden message to bot on button click? #3285

Closed SerendioSoftwares closed 7 years ago

SerendioSoftwares commented 7 years ago

System Information

Issue Description

The 2nd parameter is displayed as user send-back on Button click in Hero-Card botbuilder. I would communication to occur without an explicit message on the chat screen. For eg: the bottom code could display "Selected" to the user while sending "60" to the bot.

Code Example

builder.CardAction.imBack(session, "60", "$40-$60")

PrasadGautham commented 7 years ago

postback doesnt work???

nrobert commented 7 years ago

If you have a look to Rich card documentation (here: https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-add-rich-card-attachments) you will see that you have the following choices (at least):

So you should change imBack to postBack

SerendioSoftwares commented 7 years ago

Thank you for the replies. My problem is with this aspect of postback: " For some channels this may get mapped to a imBack."

I wish to send back a Json object and it would look really odd if it were to appear on the chatbox.

Additionally how do I send a secret message to the chatbot apart from posting the user reply on the screen.

nrobert commented 7 years ago

On which channel(s) do you want to send your json?

SerendioSoftwares commented 7 years ago

At the moment, skype and messenger- both dont have this problem. But we plan on expanding to Kik, Slack and as many channels as possible.

And, How do I send a secret message to the chatbot apart from posting the user reply on the screen?

nwhitmont commented 7 years ago

The postBack action type is the only way to do this, but as you mentioned, only some channels support it.