Luis entity is getting triggered on selection of confirmation dialog - bots

I have a confirmation dialog in my code-
PromptDialog.Confirm(context, ConfirmDocSearch,
$"Do you want to search any other document.?", attempts: 1);
but when user select yes or no it is getting trigger none dialog on Luis model. I dont want to trigger any Luis intent on Yes or No
Reviewed and retrain luis model.

Related

In Bot Framework Composer turn.recognized.Intents contains only one intent

I managed to make Luis return all intents in a query by adding
"predictionOptions":{
"includeAllIntents": true
}
to the recognizerFile: {dialogName}.en-us.lu.dialog
In the emulator I see the json that comes back containing several intents under turn.recognized.Intents. But if I make the bot send a message with the content of that collection then it just sends a collection with a single item, the top scoring intent.
Am I missing some configuration here that makes the deserialization of the Intents property to fail?

Bot Dialog Action button issue node.js

I am trying to create bot for MS Teams via Microsoft Bot Framework using some examples from the Internet.
I have created user card that has button "See Report"
function userCard(session, connector, name, workingStatus, TeamsID) {
var card = new builder.HeroCard(session)
.title(name)
.subtitle(workingStatus.toString())
.buttons([
builder.CardAction.dialogAction(session, 'userReport', TeamsID, 'See Report')
]);
return card;
}
Card is displayed without any issues. When I press on button it should trigger new dialog
//Begins the userReport dialog if the button on the userCard is pressed
bot.beginDialogAction('userReport', '/userReport');
This functionality works perfect when I test it in Bot Framework Emulator.
In MS Teams instead of triggering userReport dialog it goes to the main dialog (the one that is used when message is sent). So that this button does not work at all.
Could you, please, advise what should be adjusted/added in order to make this button work in MS Teams?
Thanks in advance!
Thank goodness you're just getting started. It looks like you're using Bot Framework V3, which is severely outdated. You should definitely switch to V4.
Teams has it's own additional trickiness. I recommend trying out and combing through each of these samples:
57.teams-conversation-bot
07.using-adaptive-cards
Then read through the Adaptive Cards blog post.
Basically, a response from an Adaptive Card comes back in activity.value, so in onTurn(), you'll want to use an if statement to watch activity.value for the value sent in your Adaptive Card when the user clicks "See Report". Then, use beginDialog or dialog.run(), as appropriate to start your dialog.

Alexa SDK Redirect to Set Session Attributes

Is there a way to temporarily redirect from one intent to another in order to fill slots or session attributes and then return to the original intent to be responded to or fulfilled?
My use-case is for asking for an account PIN as a secondary authentication after account linking. For instance, if someone asks "What are my account details?", I want that intent to change in the session attributes if it exists and if not, temporarily redirect to an intent that will prompt them for the PIN and set it...then come back and answer their account details request. Similar to the example below:
const IntentHandler = {
canHandle(input) {
return (
input.requestEnvelope.request.type === 'IntentRequest' &&
input.requestEnvelope.request.intent.name === 'MyIntent'
},
handle(input) {
const { accessToken } = input.requestEnvelope.context.System.user
// ... do stuff with accessToken
if (!input.attributesManager.getSessionAttributes().pin) {
// redirect to other intent to set the pin session attribute
}
// ...response to intent request
}
}
I can get this working with a single intent using slot filling prompts but this is a common task for several intents and would like to separate it out so it doesn't have to be configured in the console for all that require it.
FYI: using the ask-sdk for Node.js
Is this possible with the current version of the ask-sdk?
Yes, Alexa makes it easy now to switch between intents and jump right into eliciting a specific slot for the new intent.
I would use the ElicitSlot Dialog Directive and include the updatedIntent object for the new intent.
updatedIntent
Use this to change intents during the dialog or set slot values and confirmation status. See Change the intent or update slot values during the dialog. If you don't need to change the intent, slot values, or confirmation statuses, you can leave this property out of your response.
When you switch intents with this parameter, Alexa attempts to elicit the specified slot value on the new intent. The next IntentRequest to your skill will be the new intent, not the original.
Example:
Intent A is missing access token.
Intent A directs Alexa to elicitSlot "pin" from Intent B. (include info in sessionAttributes such as "previousIntent" or "nextIntent" to use as direction to Intent B)
Alexa responds to user with Intent B's elicit prompt for slot "pin".
User provides pin.
Alexa provides user input to Intent B (not A) with slot "pin" filled and Intent B sets the access token in sessionAttribtues.
Then Intent B checks sessionAttribtues for direction of which intent to return to and which slot to elicit from that intent. So you can either confirmIntent or elicitSlot for Intent A.
Intent A will receive the next user input and now detects access token.
Notice that you will have to address the user with something between switching intents. If you are using confirmIntent then it can be a simple Yes/No confirmation question such as, "Thank you for your pin, would you like me to retrieve your account details now?". The user says "Yes", and that is sent back to Intent A to complete what it started.
If you don't want this extra back and forth with the user, then as far as I know, you'll have to build the pin slot into each intent you may need to elicit it. That way, you just stay within Intent A. Less efficient code, but more efficient conversation, so it's a bit of a trade off.

Bot Framework Event for Postbacks?

My question:
I have an adaptive card with a postback button whose value is say "thisIsMyPostback". Now, I want to act on this postback as one would.
The problem is that this postback can also be typed out to reach the same result. In other words, clicking the button and also just messaging my bot "thisIsMyPostback" straight up result in the same thing.
Is there a way to separate a postback message from a 'message_received'? That way a user messaging "thisIsMyPostback" straight up would not result in the same thing as clicking the button.
Thanks!
The Adaptive Cards readme on the BotFramework WebChat GitHub repo GitHub repo states:
The data property of the action may be a string or it may
be an object. A string is passed back to your bot as a Bot Builder SDK
imBack activity, and an object is passed as a postBack activity.
Activities with imBack appear in the chat stream as a user-entered
reply. The postBack activities are not displayed.
"actions": [
{
"type": "Action.Submit",
"title": "Next",
"data": { "postBack": "thisIsMyPostback" }
}
]
If the value of the Activity doesn't have an object, then the user did not click the button.
Is there a way to separate a postback message from a 'message_received'? That way a user messaging "thisIsMyPostback" straight up would not result in the same thing as clicking the button.
No, it's not currently possible, because all messages, user or imBack/postBack, are of type "message" so there's no way to tell the difference unless you put some special text in your postBack and configure a triggerAction to recognize it.
For more information on using trigger actions, see:
https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-global-handlers#trigger-a-help-dialog

Bot framework to work with LUIS intent & match intent & pro-active dialog

I've built a bot using LUIS framework which works fine.
while working on it came through few points as mentioned below
After connecting with LUIS intent; bot is unable to check with regex intents
like
for ex dialog.matches('^helpdesk/i',function()) which i'm trying to setup
var dialog = new builder.IntentDialog({ recognizers: [recognizer] });
How to proactively send greetings message to user before inititates conversation like i would send prompt of choices to user which user can select. If nothing is fitting to that requirement i want LUIS to work and understand on that
How to know the logged in user context in Skype for Business channel
cards are not working in skype for business
For your code; I'm assuming your recognizer is your only IntentRecognizer and is the LUIS model you mention.
In this case, dialog.matches('^helpdesk/i',function()) is incorrect; your code to match against a regex should be dialog.matches(/^helpdesk/i, function())
Alternatively you could add a RegExpRecognizer to your IntentDialog:
var helpdesk = new builder.RegExpRecognizer('HelpDeskIntent', /^helpdesk/i);
var dialog = new builder.IntentDialog({ recognizers: [helpdesk, recognizer] });
As Bob said you're looking for conversationUpdate, here's an example on it sending a message when a user joins
To clarify, is this a question on having your bot know when a user is logged in? Or are you asking about session.userData?
Skype for Business does not currently support cards.
You can catch when the user is added to conversation. Check conversation.update.
Each activity has its own properties. One of them is serviceUrl.
For the third question, please provide your code.

Resources