Get custom data on button click in Webchat - botframework

In Facebook messenger, buttons (on the cards as well), can send a custom payload, along with the text of the button which was clicked. This payload is available in the sourceEvent section of the message. Also this payload has to be added in the sourceEvent manually. There is no official Bot framework API available for doing this.
This is a sample payload on FB button
https://developers.facebook.com/docs/messenger-platform/send-api-reference/button-template
My Chatbot also supports Webchat. Does Webchat supports sending such payload to the bot? Right now all I get is the text of the button clicked.

Related

Messageback like feature of Adaptive Card in Slack BlockKit

I am trying to implement messageBack feature of Adaptive Card in Slack Builder Kit where on clicking of a button I can show a default response of the bot before the response comes from the API. This could be implemented in Adaptive Card using messageBack. Is there a way to do similar thing in Slack Builder Kit template.
On clicking the button, I want to show 'Thank you for clicking' and then I want to show the response which comes from the API.
When the button is clicked, you can update the message that you sent with "Thank you for clicking" using the chat.update method. After that, you could update it once more to show the response from the API or just send another message via chat.postMessage.
Alternatively, you could send an ephemeral message with the text "Thank you for clicking" using the chat.postEphemeral method, which would only show up for the user that clicked the button and then send a regular message with the API contents in a later message.

Microsoft Bot Framework respond to Slack Block Kit UI Action Buttons

Using Microsoft Bot Framework Composer, I am sending a Slack Block Kit UI message that contains action buttons. Slack correctly displays the message, but pressing any of the action buttons results in a 400 error.
I have enabled Interactivity and set the Request URL to https://slack.botframework.com/api/Actions
Is this correct? I've tried updating to https://04458ba4816c.ngrok.io/api/slack, but then get 401 not authorized.
https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-channeldata?view=azure-bot-service-4.0
Why doesn't the Azure Bot Service Slack connector forward Events and Interactive Messages?
https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-channeldata?view=azure-bot-service-4.0

Webex AttachementActionData usage

How is this class used? If there is a submit button using Action.Submit on an adaptive card, how does the Microsoft Bot get this message?
So this question doesn't get flagged as too generic, there is a Webex adapter connected to a Microsoft bot using this exact demo.
https://learn.microsoft.com/en-us/azure/bot-service/bot-service-adapter-connect-webex?view=azure-bot-service-4.0
The OnMessageActivityAsync message gets the message from the bot, for example, if the user types "Hello", and the bot responds back with an adaptive card that has the action "Action.Submit" that will give the user a card with a submit button. Now, if the user clicks "submit", Webex should send something back to the bot. I don't think it's a message, because I never receive a message. Webex has, on it's side of documentation, a webhook with ActionAttachments. But after creating this webhook and clicking submit, what is the bot supposed to receive?
The answer to this was to change the Webex access token from the auto-generated token to the bot's access token. After doing this, the Action Attachment was working and the bot received the Event Activity.

How to add button for "Send Transcript" to Directline WebChat

I would like customers to be able to click a button to send themselves a transcript at any point in the conversation. This button should essentially send a message to the bot which would initiate an “email transcript" dialog to prompt for their email and send the transcript. I was able to add a button to the directline webchat client (in my title bar) but I can't figure out how to have it create an activity for the bot. I have a custom store that sends an "inactive" activity but I wasn't able to use this same method to make the button send an activity. Can this be achieved? Or is there another way for customers to get a copy of their transcript?
I have achieved the actual transcript retrieval and emailing in code, initiates by a LUIS intent, I just want to provide an intuitive "always there" option to do this.
The WebChat offers a simple sample that shows you how to send activities programmatically to the bot. In this sample they are creating a separate button with an Event Listener, which will sent your message as a message activity.
If you would like to sent it as an event in the background, you could have a look at this sample, which you could combine with the event listener of the first example.
How to send a message programmatically
How to send welcome event
Note: you need to use the JavaScript WebChat, it is not possible to add this functionality to the iFrame version of the Bot Service.

How to echo clicked button text from Rich cards in web chat

We've developed a bot and are sending rich cards to the client. When a user connects to our bot through web chat and clicks a button within those rich cards, the text of the buttons the user clicked on are not echoed to the chat window as if the user would have typed it himself, unlike messenger for example.
The problem with this is that if the user scrolls up in the conversation, all he sees is text written by the bot and it makes it hard for him to see what choices he's made (what buttons were clicked), and therefore what bot's answers correspond to what choice.
Make sure that the Type of your CardAction (your buttons) is set to imBack. Then fill the Value property with the text you want to show in the chat.
Per the documentation:
CardAction.Type: imBack
CardAction.Value: Text of the message to send
to the bot (from the user who clicked the button or tapped the card).
This message (from user to bot) will be visible to all conversation
participants via the client application that is hosting the
conversation.

Resources