BotFramework Carousel CardAction按钮不OpenUrl

时间:2016-09-29 17:24:51

标签: carousel skype botframework

我有一个旋转木马,但在Skype中单击CardAction按钮时,它没有打开URL。它虽然在模拟器中工作。是否有一个原因?

        foreach(var botAmazonItem in botAmazonItems)
        {
            List<CardImage> cardImages = new List<CardImage>();
            cardImages.Add(new CardImage(url: $"{botAmazonItem.imageUrl}"));
            List<CardAction> cardButtons = new List<CardAction>();
            CardAction plButton = new CardAction()
            {
                Value = botAmazonItem.detailsPageUrl,
                Type = ActionTypes.OpenUrl,
                Title = botAmazonItem.title
            };
            cardButtons.Add(plButton);
            HeroCard plCard = new HeroCard()
            {
                Title = $"{botAmazonItem.title}",
                Subtitle = $"{botAmazonItem.formattedPrice}",
                Images = cardImages,
                Buttons = cardButtons
            };
            Attachment plAttachment = plCard.ToAttachment();
            replyToConversation.Attachments.Add(plAttachment);
        }

1 个答案:

答案 0 :(得分:2)

尝试更改&#34;值&#34;链接到https://而不是http://。 Skype要求所有外部链接都是https://

以下代码(基于您的代码)有效:

        var botAmazonItems = new List<AmazonBotItem>();
        botAmazonItems.Add(new AmazonBotItem() { imageUrl = "http://placekitten.com/200/300", title = "Microsoft", formattedPrice = "$8.95", detailsPageUrl = "https://www.microsoft.com" });
        botAmazonItems.Add(new AmazonBotItem() { imageUrl = "http://placekitten.com/300/300", title = "Bot Framework", formattedPrice = "$2.95", detailsPageUrl = "https://www.botframework.com" });

        var reply = activity.CreateReply();
        reply.AttachmentLayout = AttachmentLayoutTypes.Carousel;
        reply.Attachments = new List<Attachment>();

        foreach (var botAmazonItem in botAmazonItems)
        {
            List<CardImage> cardImages = new List<CardImage>();
            cardImages.Add(new CardImage(url: $"{botAmazonItem.imageUrl}"));
            List<CardAction> cardButtons = new List<CardAction>();
            CardAction plButton = new CardAction()
            {
                Value = botAmazonItem.detailsPageUrl,
                Type = ActionTypes.OpenUrl,
                Title = botAmazonItem.title
            };
            cardButtons.Add(plButton);
            HeroCard plCard = new HeroCard()
            {
                Title = $"{botAmazonItem.title}",
                Subtitle = $"{botAmazonItem.formattedPrice}",
                Images = cardImages,
                Buttons = cardButtons
            };
            Attachment plAttachment = plCard.ToAttachment();
            reply.Attachments.Add(plAttachment);
        }