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

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.

Related

How to move messenger thread control to Page Inbox in one click

A chatbot (Bot Framework v4, NodeJS) is connected to an app tied to a Facebook page (as primary receiver). Users starting a chat on the facebookpage are chatting with a chatbot. Works fine.
Sometimes the admin of the Facebook page needs to chat directly to the user. He can use the Page Inbox app for that. To be able to do that, he needs Thread Control
Currently the steps he needs to perform to get Thread Control for a certain conversation are:
Find the conversation he wants to join (get Thread Control over)
Move that conversation to 'Done' via the checkmark
Find the conversation again by adding the 'done'-filter to the view
Click the Move to Main button (the envelop in the top right corner)
Remove the 'done' filter to find the conversation again
Chat with the user (without the chatbot in the conversation)
After moving the conversation to Done again, the chatbot owns the conversation again.
Is there a more efficient way to get thread control

Clicking notification take me to generic feed rather than to chat section

When I receive a notification In Teams from Bot A and I click on the popup the system does not navigate to the Bot A chat section, but to the generic Feed.
clicking on this take me to generic feed i.e
We got an update from the engineering team, this is expected behavior. The left side panel will just stay at "Feed", which is by design.

How to create MS Teams Survey App Messaging Extension

I am currently creating a survey app for ms teams similar to Polly.ai/survey monkey
The flow would be
User installs app,
app appears as messaging extension on the chat window,
user clicks app to opens page to create survey,
on submit an adaptive card is generated,
the same is responded back to teams,
The new card appears on the message Hi,
I am currently creating a survey app for ms teams similar to Polly.ai/survey monkey
The flow would be
User installs app,
app appears as messaging extension on the chat window,
user clicks app to opens page to create survey,
on submit an adaptive card is generated=>
the same is responded back to teams =>
The new card appears on the message create pane,
User hits enter to post the survey to the group,
All the group members respond to the survey ,
The same is logged
Can anyone help me in providing some links from where I can start.
Or maybe throw some light on what should be my approach.
My progress so far.
Created a teams bot,
On messaging extension invoke returned url that contains HTML for survey creation which is created in vue.js. Used msteams js to submit the json for created survey back to the bot,
Generated an adaptive card with json received and the a new survey created in db,
Sent the card back to teams as message attachment,
The card is displayed in message create pane,
User hits enter to post the card in the group,
Caught the action.submit event from adaptive card on bot framework.
Also, please note while I am generating the card I don’t have user email in the turncontext as well.
Please throw some light on this
Thanks
Please have a look at App templates available. I think for your case Poll and Survey are the best app template available.
Thanks

Display Additional Text in Teams Client Toast for incoming message that contains an Adaptive Card?

We have a Teams bot that sends messages containing adaptive cards to end users (via the Bot Framework). When the chat window is not in focus, the Teams client will show the incoming message in a Toast/Popup that appears in the bottom right of the screen. However when the message contains just a card, the toast is nondescript and there is no hint to the user as to what the "Sent a card" maybe all about. So all card message toasts appear to be the same. See image
Is it possible to display a text message alongside the "Sent a card" in Toast so the user can decide whether to immediately interact with the message or ignore it. Any other visual cues we can provide that would appear in the Toast?
You have to set a summary when sending cards via Bot Framework.
Like this:
var response = MessageFactory.Text(string.Empty);
response.Attachments.Add(cardAttachment);
response.Summary = "showing custom greeeting from the Bot - rather than a card";
await turnContext.SendActivityAsync(response, cancellationToken);
The summary is shown in the notification instead of "sent a card"
This was implemented quite some time ago.

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.

Resources