1

In Fulfillment, I need to call the same function for no. of intents. Current code is given below.

I want to create a single app.intent(instead of multiple like mentioned below) functions for multiple intents. I need to create a single app.Intent function put all the possible intent names. Please help me out how to achieve this.

app.intent('Intent1', (conv,{vardata})=>{ 
Result(vardata);
});   
app.intent('Intent2', (conv,{vardata})=>{ 
Result(vardata);
});    
app.intent('Intent3', (conv,{vardata})=>{ 
Result(vardata);
});    

Result(vardata)
{
//do something based on vardata value
}
Jordi
  • 3,041
  • 5
  • 17
  • 36

1 Answers1

1

You should be able to combine the handlers into one by providing an array instead of a single string value as a name.

app.intent(['Intent1', 'Intent2', 'Intent3'], (conv,{vardata})=>{ 
  Result(vardata);
});     

Result(vardata)
{
//do something based on vardata value
}
Jordi
  • 3,041
  • 5
  • 17
  • 36