2016-09-29 46 views
1

我有一個傳送帶,但當在Skype中單擊CardAction按鈕時,它不會打開URL。它在Emulator中工作。是否有一個原因?BotFramework Carousel CardAction Button does not OpenUrl

 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); 
     } 

回答

2

嘗試將您的「值」鏈接更改爲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); 
     } 
+0

哦,夥計!我剛剛修復了亞馬遜圖片的確切問題,我可以發誓我已經證實detailsPageUrl確實是https,但是第二次看起來並非如此。這做到了。對於那個很抱歉! –