Rich Responses - Basic Card
Supported on
● actions.capability.SCREEN_OUTPUT
Image, Title, Sub-title, Text body,
Link button, Border
1. Check whether a surface the user is using supports a screen.
[Yes] 2. Send a Basic Card with a Link Button.
[No] 3. Check whether the user has a surface which is supporting a screen.
[Yes] 4. Request to transfer the user to the surface.
[Yes] 5. Send a Basic Card with a Link Button.
Send a Basic Card w/ a Link Button
?
// 1. Check whether a surface the user is using supports a screen
const screenSupported =
app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT);
if (screenSupported) {
// 2. Send a Basic Card with Link Button
} else {
// 3. Check whether the user has a surface which is supporting a screen.
const screenAvailable =
app.hasAvailableSurfaceCapabilities(app.SurfaceCapabilities.SCREEN_OUTPUT);
if (screenAvailable) {
// 4. Request to transfer the user to the surface.
const context = "<context>";
const notificationTitle = "<title>";
app.askForNewSurface(
context, notificationTitle, [app.SurfaceCapabilities.SCREEN_OUTPUT]);
} else {
...
}
}
exports.dialogflowFirebaseFulfillment =
functions.https.onRequest((request, response) => {
const app = new App({request, response});
const inputWelcome = (app) => { ... };
const newSurface = (app) => {
// 5. Send a Basic Card with a Link Button.
};
const actionMap = new Map();
actionMap.set("input.welcome", inputWelcome);
actionMap.set("new_surface", newSurface);
app.handleRequest(actionMap);
});
さっそくアシスタントアプリにつないでみましょう。すると、Default Welcome Intentが作動します。ここで、"<context>. Is it okay if I send that to your phone?"という応答がGoogleアシスタントから返ってきます。つまり、あなたのAndroid端末に通知を送っても良いですか?と聞いてきています。Ok、と返しましょう。