I am having trouble getting the getRawInput() method to capture user input after it's initial call. I would like the user to choose and action, and then the assistant to respond with a question, which the user has to answer to go forward. For example, a user would like to transfer money from a checking account to a savings account would say "I would like to make a transfer." The assistant will ask "Which account would you like to transfer from." The user would respond with the account they would like to transfer from. The issue seems to be that assistant isn't taking the second input, and I get the error "Action: {name of my action} isn’t responding right now. Try again soon." Please let me know if there is a better way or a more appropriate method to call for in-line dialogues.
Here is the code I'm trying to execute:
else if (assistant.getRawInput() === 'I want to make a transfer') {
let inputPrompt = assistant.buildInputPrompt(true, 'Sure, which account would you like to transfer from? You can say checking or savings.');
assistant.ask(inputPrompt);
if(assistant.getRawInput() === 'checking') {
let transFrom = 'checking';
let transTo = 'savings';
let inputPrompt = assistant.buildInputPrompt(true, 'You are going to make a transfer from your ' + transFrom + ' account to your ' + transTo + ' account. What is the amount you would like to transfer?');
assistant.ask(inputPrompt);
let amtInput = assistant.getRawInput();
let amt = parseInt(amtInput);
transferMoney(transFrom, transTo, amt);
inputPrompt = assistant.buildInputPrompt(true, 'Cool, you have transfered ' + amt + ' dollars from your ' + transFrom + ' account to your ' + transTo + ' account. Your new balance is ' + customer1.chkBal + ' dollars in your ' + transFrom + ' account and ' + customer1.savBal + ' in your ' + transTo + ' account.');
assistant.ask(inputPrompt);
} else if (assistant.getRawInput() === 'savings') {
let transFrom = 'savings';
let transTo = 'checking';
let inputPrompt = assistant.buildInputPrompt(true, 'You are going to make a transfer from your ' + transFrom + ' account to your ' + transTo + ' account. What is the amount you would like to transfer?');
assistant.ask(inputPrompt);
let amtInput = assistant.getRawInput();
let amt = parseInt(amtInput);
transferMoney(transFrom, transTo, amt);
inputPrompt = assistant.buildInputPrompt(true, 'Cool, you have transfered ' + amt + ' dollars from your ' + transFrom + ' account to your ' + transTo + ' account. Your new balance is ' + customer1.chkBal + ' dollars in your ' + transFrom +' account and ' + customer1.savBal + ' in your ' + transTo + ' account.');
assistant.ask(inputPrompt);
}