Map/Directions Cards & Integrate Actions/Intents such as CALL, EMAIL - With Dialogflow, Actions on Google, NodeJS Client V2

百般思念 提交于 2019-12-01 17:27:37

问题


I have been trying to figure out how to construct Maps/Directions Cards using Dialogflow and the NodeJS Client.

After doing a little bit of research, I found this SO that explains how to generate a static map URL (as an image) using Google Directions API and Polylines. But in my opinion, there should be a feature in Dialogflow that allows developers to build those types of cards, along with associated built-in Intents or Events such as CALL, EMAIL, DIRECTIONS, etc.

Below is an example of what I am trying to build:

Below is a piece of code that I wrote, trying to reproduce the call to actions (Call, Email, Directions, etc). I am also aware of follow-up actions types but I am not sure how to make it work within my app (How to trigger call/email events?)

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));
  }

I also created those intents within the Dialogflow dashboard as follow-up intents. In short, I want a user to be able to tap one of these buttons and trigger an action, such as CALL, EMAIL, etc. Thanks for any help.

来源:https://stackoverflow.com/questions/49917405/map-directions-cards-integrate-actions-intents-such-as-call-email-with-dial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!