Microsoft BotFramework: Dual user inputs - botframework

I'm trying to create a bot, where users are able to select an option from an adaptive card, or type it in. So I am currently displaying a carousel of adaptive cards, and then using a text prompt for a possible input.
Unfortunately, since I'm using a prompt, when I click an action from the card, I get an "I don't understand" output from the bot, as it is expecting a user input.
Is there any way to achieve this?

I am currently displaying a carousel of adaptive cards, and then using a text prompt for a possible input.
I do a test and can reproduce the issue on my side. I assume that you call PromptDialog.Text method after you send an adaptive card to client for collecting user inputs, the PromptDialog.Text would expect a string, if you directly enter the input filed(s) and submit it to bot, it will send back a Activity message with your input value, which would throw "I don't understand" message and let you retry again.
If you provide a string before you enter input field(s) and submit it, your bot should work as expected.

Related

In Slack, is it possible for an app to respond to a slash command by displaying a picker popup?

As example, let's say I wanted to write an app such that when the user types /movie in a channel, a list of popular movies is shown, the user selects one, and as a result a link to that movie in IMDB is inserted into the channel as text. Is something like that possible?
Many thanks.
That's possible! A slash command is the vessel for further interactivity. You can have your slash command trigger a modal (https://api.slack.com/surfaces/modals).Your modal would offer a list of options and once the user submits, your app will be notified with a view_submission payload. You can test modal payloads using the Block Kit Builder which includes options to list items.

Sending adaptive card to multiple users in Teams referencing Forms dynamic content

Based on the value of a question submitted in a Microsoft Form, I want to send an adaptive card to one or more people via Teams. I think I have the end steps figured out. I have the adaptive card nested within an Apply to each action. The Recipient of the adaptive card is set to the Current item of the Apply to each, and the selection on the Apply to each is the output from a variable.
That variable is where I'm hung up. I'm currently using an if formula to calculate the email addresses. This is probably where I need help.
if(equals(outputs('Get_response_details')?['body/r43d6bce2bb684bf79bff6d8c61fb8f9c'],'Finance'),'josh#.com',if(equals(outputs('Get_response_details')?['body/r43d6bce2bb684bf79bff6d8c61fb8f9c'],'Sales Operations'),'robby#.com','josh#.com'))
You can send adaptive cards to team/group/1:1 by getting user id / channel id.please check this docs

Use input for update message in a Teams Flow - Post Adaptive Card action

With the "Post an adaptive card" action in Flow / Power Automate -> Microsoft Teams there's the option to specify an "update message" following the user response to the card.
How can I access the data inputs and the submitActionId for use in this message?
The use case is as follows:
user receives the card and enters data into a textfield.
user clicks one of two buttons (similar to "approve" and "reject")
(what I want to do:) card is updated to show what text the user entered and which button was pressed.
I can access other dynamic data that have been created by previous actions in the "update message" field. But the output of this adaptive card action itself is not available "within" the action, not by normal means anyway. Later in the flow it's necessary to parse the JSON output of this action.
Supplementary question: Is it possible to style the "update message". Currently it appears all bold.
Supplementary info: the "update message" field does not appear to accept another adaptive card (would have been logical...). If I enter adaptive card json there, it just gets spat back out literally in Teams.

Differentiate between 1:1 Bot conversations

I am in a 1:1 chat with my bot.
as part of a command, the bot responds with a card (say Card1) and a couple of action buttons. I persist the conversation id and activity id from the context.
I issue another command. In response, the bot responds with a card (say Card2) and a couple of action buttons. I have saved this conversation id and activity id also from the context.
At this point, the user may go and click an action button in Card1. I am hoping to identify Card 1 using the persisted activity id- but on inspecting the activity Id I see that its
different from the value I persisted. How do I correctly identify a Card1 to respond to its action items?
(In 1:1, the conversationId for Card1 and Card2 is the same)
Each interaction between BOT and user is an activity. So, every activity will have a different ID, meaning each time a user or BOT sends a message it will have a different activity ID.
I would assume that both card1 and card2 have different values on their buttons, if not then use some different text to identify which card button was pressed.
The BOT doesn't know that there was a button press or the user just typed in a message. BOT would treat each message separately unless there is a formflow or promptdialog.
Buttons have multiple fields such as Title or Value. You can use different value for each card. That way you would be able to identify which card it was that was clicked as the value of a button is sent back to the BOT.

Pre-fill Slack message in web interface

Is there a URL parameter or other means to pre-populate the message field when navigating to a Slack channel in Slack's web interface?
That is, a user would click on a link to a Slack channel in their browser, and on arriving at the linked page would have part of their message already written, but not sent.
When you work with the Slack API, they offer some "confirmation fields" codes to request user confirmation before taking certain action.
This could apply to your case, by getting a certain piece of text ready but requiring an OK before actually sending that over the chat.
"confirm": {
"title": "Are you sure?",
"text": "Wouldn't you prefer a good game of chess?",
"ok_text": "Yes",
"dismiss_text": "No"
}
Protect users from destructive actions or particularly distinguished decisions by asking them to confirm their button click one more time. Use confirmation dialogs with care.
These fields should be presented as a JSON hash buried deep within the confirm field of an action within the actions array that's also part of an attachment that's inside the attachments array field of a message.

Resources