小编Van*_*and的帖子

dialogflow-fulfillment-library和express,该如何处理?

我正在尝试使用带有express的dialog-fulfillment-library库,而没有firebase函数。我在寻找如何重新处理代理方面遇到麻烦。

    const { WebhookClient, Card, Suggestion } = require('dialogflow-fulfillment');

    module.exports = function () {

      let self = {};

      self.create = function (req, res, next) {
        const agent = new WebhookClient({request: req, response: res});

        agent.add(new Suggestion(`Quick Reply`));
        agent.add(new Card({
            title: `Title: this is a card title`,
            imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png',
            text: `This is the body text of a card.  You can even use line\n  breaks and emoji! `,
            buttonText: 'This is a button',
            buttonUrl: 'https://assistant.google.com/'
          })
        );

       res.json(agent);
      };

     return self;
   };
Run Code Online (Sandbox Code Playgroud)

我收到TypeError:将圆形结构转换为JSON我曾尝试回收代理,但是在dialogflow端它不起作用。使用: …

node.js express dialogflow-es

1
推荐指数
1
解决办法
1907
查看次数

标签 统计

dialogflow-es ×1

express ×1

node.js ×1