映射/方向卡并集成操作/意图,例如CALL,EMAIL-使用Dialogflow,Google上的操作,NodeJS Client V2

All*_*lJs 5 javascript google-maps node.js actions-on-google dialogflow-es

我一直在尝试找出如何使用DialogflowNodeJS Client构造Maps / Directions卡的方法。

经过一些研究,我找到了这种SO,它解释了如何使用Google Directions API和Polylines 生成静态地图URL(作为图像)。但是我认为,Dialogflow中应该有一个功能,允许开发人员构建这些类型的卡,以及相关的内置Intent或Event(例如CALLEMAILDIRECTIONS等)。

以下是我要构建的示例:

在此处输入图片说明

在此处输入图片说明

以下是我编写的一段代码,试图重现号召性用语(电话,电子邮件,路线等)。我也知道后续操作的类型,但不确定如何使其在我的应用程序中起作用(如何触发通话/电子邮件事件?)

function triggerAction(conv) {

        let actions = ['Call','Fax','Directions', 'Website'];
        conv.ask(new BasicCard({
            text: `Some description`, // Note the two spaces before '\n' required for
            // a line break to be rendered in the card.
            subtitle: 'This is a subtitle',
            title: 'Title: this is a title',
            buttons: new Button({
                title: 'This is a button',
                url: 'https://assistant.google.com/',
            }),
            image: new Image({
                url: IMG_URL_AOG,
                alt: 'Image alternate text',
            }),
        }));

        conv.ask(new Suggestions(actions));
  }
Run Code Online (Sandbox Code Playgroud)

我还在Dialogflow仪表板中创建了这些意图作为后续意图。简而言之,我希望用户能够点击这些按钮之一并触发一个操作,例如CALL,EMAIL等。感谢您的帮助。