Я предполагаю, что мессенджер, вы имеете в виду Facebook Messenger?
Чтобы использовать базовую карту с Google Assistant, сначала необходимо убедиться, что вывод на экран поддерживает использование интерфейса карты. Вы можете сделать это с:
if (!conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')) {
conv.ask('Sorry, try this on a screen device or select the ' +
'phone surface in the simulator.');
return;
}
После того, как вы проверили, поддерживает ли экран использование базовой карты, вы можете создать новый экземпляр класса Basic Card с кодом, подобным:
// Create a basic card
conv.ask(new BasicCard({
text: `This is a basic card. Text in a basic card can include "quotes" and
most other unicode characters including emoji ?. Basic cards also support
some markdown formatting like *emphasis* or _italics_, **strong** or
__bold__, and ***bold itallic*** or ___strong emphasis___ as well as other
things like line \nbreaks`, // 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: 'https://example.com/image.png',
alt: 'Image alternate text',
}),
display: 'CROPPED',
}));
Более подробная информация доступна в документации Google .