1

I am working on building bot using v4 of bot framework. I have the functionality to share the hero card within the channel. i.e If the bot is deployed in facebook we need to share within the contacts same for skype too. How can I achieve this?

Desired output like this

Thanks in Advance.

Dileep Kanta
  • 51
  • 2
  • 8
  • In the Facebook channel, you can send [Templates](https://developers.facebook.com/docs/messenger-platform/send-messages/templates/) through the bot's channel data that you can add different Facebook actions to such as sharing. I can add a sample of this functionality, but, before I do, can you elaborate on how you want to share the cards through Skype? To the extent of my knowledge, you can only share contact information with other users on Skype. – tdurnford Feb 21 '19 at 21:35
  • Hi @tdurnford. In skype you can see forward option for the cards. which shares cards to the contact whom we selected. I want to add that functionality to the **card action**. Means my carousel will have hero cards attached which has a share button when the user taps on that we have to share that particular card to the contacts whom we selected in skype. Same functionality applies to Facebook. – Dileep Kanta Feb 22 '19 at 07:23

1 Answers1

2

Skype

Any card sent through Skype already has the functionality to be forwarded to other users. 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.

enter image description here

Facebook

You have to send a Messenger Template through the activity's channel data to include the share functionality on Facebook Messenger. In the template's element, you have to add a button with type 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"
            }]
          }
        ]
      }
    }
  }
});

enter image description here

Hope this helps!

tdurnford
  • 3,632
  • 2
  • 6
  • 15