简体   繁体   English

Bot Framework v4英雄卡共享按钮

[英]Bot framework v4 hero card share button

I am working on building bot using v4 of bot framework. 我正在使用Bot框架v4构建Bot。 I have the functionality to share the hero card within the channel. 我具有在频道内共享英雄卡的功能。 ie If the bot is deployed in facebook we need to share within the contacts same for skype too. 即,如果该机器人被部署在facebook中,我们也需要在Skype的联系人中共享。 How can I achieve this? 我该如何实现?

Desired output like this 所需的输出是这样的

Thanks in Advance. 提前致谢。

Skype Skype的

Any card sent through Skype already has the functionality to be forwarded to other users. 通过Skype发送的任何卡都已经具有转发给其他用户的功​​能。 All the user has to do is press the forward button that displays on the side of the card. 用户要做的就是按下显示在卡侧面的前进按钮。 However, Skype does not support adding a share button directly on the card. 但是,Skype不支持直接在卡上添加共享按钮。

在此处输入图片说明

Facebook Facebook的

You have to send a Messenger Template through the activity's channel data to include the share functionality on Facebook Messenger. 您必须通过活动的渠道数据发送Messenger模板 ,以包括Facebook Messenger上的共享功能。 In the template's element, you have to add a button with type element_share . 在模板的元素中,您必须添加一个类型为element_share的按钮。 See the example below. 请参见下面的示例。

await turnContext.sendActivity({
  channelData: {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "generic",
        "elements": [
          {
            "title": "Three Strategies for Finding Snow",
            "subtitle": "How do you plan a ski trip to ensure the best conditions? You can think about a resort’s track record, or which have the best snow-making machines. Or you can gamble.",
            "image_url": "https://static01.nyt.com/images/2019/02/10/travel/03update-snowfall2/03update-snowfall2-jumbo.jpg?quality=90&auto=webp",
            "default_action": {
              "type": "web_url",
              "url": "https://www.nytimes.com/2019/02/08/travel/ski-resort-snow-conditions.html",
              "messenger_extensions": false,
              "webview_height_ratio": "tall"
            },
            "buttons": [{
              "type":"element_share"
            }]
          }
        ]
      }
    }
  }
});

在此处输入图片说明

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM