Reconfiguring a request
I am using MS bot builder node.js SDK. Before one of the most recent updates, when the request is retry, it sends the same message text to the user as the retry request.
However, it now sends a default text message to the system which "I didn't understand". Please try again. "However, I want the retry requests to always be the same as the original message, and if possible, want to apply this globally, meaning I don't want to configure the retry request for every invitation I sending to the user.
I've looked around but couldn't find a way yet.
Thank!
source to share
You can change the prompts to automatically set the prompt as an invitation to try again. The interface shows how arguments are passed to base classes , so we can change this request behavior by calling a method in . Prompts
Prompt
Prompts
Here is an example on how to do it with Prompts.confirm
const promptPrefix = 'BotBuilder:prompt-';
bot.dialog('/', [
(session) => {
builder.Prompts.confirm(session, 'Say yes or no');
},
(session, args) => {
session.endConversation('You said: ' + session.message.text);
}
]);
builder.Prompts.confirm = (session, prompt, options) => {
var args = options || {};
args.prompt = prompt || args.prompt;
// If options.retryPrompt was passed in use this, otherwise use prompt
args.retryPrompt = args.retryPrompt || args.prompt;
session.beginDialog(promptPrefix + 'confirm', args);
};
Modified Prompts.confirm file in action:
source to share