5

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:

enter image description here

enter image description here

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.

AllJs
  • 1,760
  • 4
  • 27
  • 48
  • 1
    I may have missed it (if so, I apologize), but is there a question here? If so, can you make it clear what you've tried and what didn't work? Or what you're trying to do that you couldn't? – Prisoner Apr 19 '18 at 12:18
  • I guess my question is about 1- How to build these types of cards (see screenshots), using Dialogflow & the Nodejs Client. 2-How to configure "Click to call event", "Click to email event", "Click to get directions event", etc. The piece of code I share below is my starting point. I'm now trying to figure out how to properly create those events (within Dialogflow) and make them work in harmony with the Nodejs Client. You don't have to apologize for anything. I really appreciate you taking the help me sort this out. I hope I was clear enough. If not please get back to me. – AllJs Apr 19 '18 at 19:22

0 Answers0