我使用nodejs集成了对话流和信使,这对于文本交换是很好的。我对在messenger中创建卡片感到困惑。有人能帮上忙吗?
我已经集成了facebook messenger机器人与网站。当客户访问网页时,机器人将提供帮助。我想展示一下那个机器人里的牌。请为此需求提供参考或解决方案。请查看此img Like this I want to show
发布于 2018-11-06 05:10:56
我猜messsenger是指Facebook Messenger吧?
要在Google Assistant中使用基本卡,首先必须检查屏幕输出是否支持卡UI的使用。您可以使用以下命令来完成此操作:
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',
}));有关更多信息,请访问via Google's documentation。
https://stackoverflow.com/questions/53120385
复制相似问题