I have been trying to achieve the following flow in dialogflow. So if a user selects from any of the following four rich responses(facebook,google,amazon,microsoft), the user will again be prompted to choose if they want a random interview problem or specific dsa topic(of that company) after which the user get's a question from that category
My code for this something like this
app.intent(COMPANY_INTENT, (conv) => {
const company = conv.parameters[COMPANY_ENTITY].toLowerCase();
conv.ask( "dsa or shuffle" );
if(company=="google" ) {
var set1=[
'"here is a question from google1 reverse a linked list"',
'"here is a question from google2 reverse a linked list"'];
var pick = Math.floor( Math.random() * set1.length );
var response = set1[pick];
conv.ask( response );
} else if(company=="microsoft"){
conv.ask("here's a question from microsoft reverse a linked list");
} else if(company=="facebook"){
conv.ask("here's a question from facebook reverse a linked list");
} else{
conv.ask("failed");
}
});
I am trying to achive the flow where the user can be prompted to choose between random question and dsa type question of the specific company and after that accordingly give the problem to user. Can someone tell how to do this or code this logic.