简体   繁体   中英

How to map multiple intents to one handler in dialogflow-fulfillment?

There are multiple intents in my bot that can use a single handler.

In v1, this was done by

function handler (agent){
  //handler code
}

let intentMap = new Map();
intentMap.set('Intent1', handler);
intentMap.set('Intent2', handler);

How can the same be achieved in v2?

Thanks in advance

I found one way to do this

app.intent('Intent1', (conv) => {
   //handler code
});

app.intent('Intent2', 'Intent1');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM