Reputation: 5
I have added retrySpeak property to builder.prompt.text incase if the user not responds for a while. But only the text in speak property will be spoken and not retrySpeak text. the below is the dialog which I am triggering from default dialog. I am testing this from cortana mobile app. Is there any property I missed here?
bot.dialog("mainServices", [
function(session){
builder.Prompts.text(session, 'How can I help you?', {
speak: 'How can I help you?',
retrySpeak: 'How can I help you,please say something',
inputHint: builder.InputHint.expectingInput
});
}
])
.triggerAction({
// The user can request this at any time.
// Once triggered, it clears the stack and prompts the main services again.
matches: /^start over$|^go back to main services$|^begin again$|start over services/i,
confirmPrompt: "This will cancel your request. Are you sure?"
});
Upvotes: 0
Views: 76
Reputation: 843
This property is actually a re-prompt for if the response from the user was invalid, as opposed to a lack of response. For example, if speak prompted for a time (in my example a number), and the bot receives a string it cannot parse instead, retrySpeak is prompted asking for a valid message. This is where you can tell the user what input type you are expecting, or to enter a value within a set range, etc.
bot.dialog("/", [
function(session){
builder.Prompts.number(session, 'Please enter a time for your reservation', {
speak: 'Please enter a time, 1-4, for your reservation.',
retryPrompt: 'That is not a number!', //what bot types
retrySpeak: 'I\'m sorry. That is not a valid time. Please enter a time between 1:00 and 4:00', //what Cortana says
inputHint: builder.InputHint.expectingInput
});
},
function(session, results){
console.log(results)
session.endConversation();
}
])
If you are particularly looking for a timeout check, take a look at this botbuilder-timeout package, which reprompts after a certain amount of time. Please keep in mind that it's a third party app and I haven't tested it myself. :)
Upvotes: 1