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.