代码之家  ›  专栏  ›  技术社区  ›  Avision

Dialogflow webhook节点.js-添加在处理*intent之后运行*的处理程序/中间件

  •  4
  • Avision  · 技术社区  · 6 年前

    我在用Dialogflow节点.jswebhook组件与express。这是样板。

    import { dialogflow } from 'actions-on-google';
    import express from 'express';
    import bodyParser from 'body-parser';
    
    // app init, handle intents
    const app = dialogflow()
    app.intent('Default Welcome Intent', conv => {
      conv.ask('Welcome to the awesome reminder action!');
    });
    app.intent('Some Custom Intent', conv => {
      conv.ask('Say something');
    });
    
    // bind to express
    express().use(bodyParser.json(), app).listen(5000)
    

    现在,我可以向dialogflow应用程序添加一个中间件(使用 app.middleware(function) 之前 之后 意图得到处理?

    1 回复  |  直到 6 年前
        1
  •  2
  •   Abhinav Tyagi    6 年前

    也许是这些 solution1 solution2 solution3 conv.ask conv.close 喜欢

    app.intent('Default Welcome Intent', conv => {
      conv.ask('Welcome to the awesome reminder action!');
      // call after function here
    });