簡體   English   中英

如何使用API​​.ai(對話框流程)在Messenger中創建卡

[英]How to create card in messenger using API.ai (dialogflow)

我通過使用nodejs集成了對話框流和Messenger,這對於文本交換是很好的。 我對在Messenger中創建卡感到困惑。 有人可以幫忙嗎?
我已經將facebook Messenger bot與該網站集成在一起。 當客戶訪問該機器人的頁面時,它將提供幫助。 我想在那個機器人上顯示卡。 請為此要求提供參考或解決方案。 請參閱此img 我想展示

我是由Messenger假設的,您是說Facebook Messenger?

要將Basic Card與Google Assistant一起使用,您首先必須檢查屏幕輸出是否支持使用Card 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;
}

測試屏幕是否支持使用基本卡之后,可以使用以下代碼創建基本卡類的新實例:

// 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文檔獲取更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM