BotFramework 轮播 CardAction 按钮不 OpenUrl

BotFramework Carousel CardAction Button Doesn't OpenUrl

我有一个旋转木马,但在 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);
        }

尝试将您的 "value" 链接更改为 https:// 而不是 http://。 Skype 要求所有外部链接都是 https://

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

        var botAmazonItems = new List<AmazonBotItem>();
        botAmazonItems.Add(new AmazonBotItem() { imageUrl = "http://placekitten.com/200/300", title = "Microsoft", formattedPrice = ".95", detailsPageUrl = "https://www.microsoft.com" });
        botAmazonItems.Add(new AmazonBotItem() { imageUrl = "http://placekitten.com/300/300", title = "Bot Framework", formattedPrice = ".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);
        }