BotFramework 4中ReceiptCard在Skype仅显示图标问题求助
Hey there! Let's fix that frustrating Skype ReceiptCard issue where only the icon shows up—Web Chat and Telegram working fine makes this extra confusing, but we can get it sorted.
What's likely going on
Skype has stricter requirements for how ReceiptCards are structured compared to other channels. Your current code leaves several key fields empty or incomplete, which Skype's renderer interprets as an invalid/incomplete card, so it only shows the icon instead of the full content.
Step-by-step fix
Let's adjust your GetReceiptCard method to include all the fields Skype expects to render the full card:
private static Attachment GetReceiptCard(BasketDetails basketDetails) { // Calculate total (assuming your Product model has a Price property) var totalAmount = basketDetails.Products.Sum(p => p.Price).ToString("C"); var itemCount = basketDetails.Products.Count.ToString(); var receiptCard = new ReceiptCard { // Use a clear, receipt-focused title Title = "Your Order Confirmation", // Merchant name is a critical field for Skype's card rendering MerchantName = "Your Store Brand Name", // Add Price to each ReceiptItem (Skype needs this to display line items) Items = basketDetails.Products.Select(r => new ReceiptItem( title: r.Name, quantity: "1", price: r.Price.ToString("C"), // Optional: Add a product image to improve readability image: new CardImage(url: "https://your-store.com/images/products/" + r.Id + ".jpg") )).ToList(), // Add factual order details (Skype uses these to populate card metadata) Facts = new List<Fact> { new Fact("Order Number", $"ORD-{Guid.NewGuid().ToString().Substring(0,5)}"), new Fact("Order Date", DateTime.Now.ToString("MM/dd/yyyy hh:mm tt")) }, // Total cannot be empty—Skype requires this to recognize it as a valid receipt Total = totalAmount, // Optional but recommended: Include tax/VAT if applicable Tax = basketDetails.Tax?.ToString("C") ?? "$0.00", VAT = basketDetails.VAT?.ToString("C") ?? "$0.00", // Optional: Add a button for users to view their full order Buttons = new List<CardAction> { new CardAction(ActionTypes.OpenUrl, "View Full Order", value: "https://your-store.com/orders") } }; return receiptCard.ToAttachment(); }
Key changes explained
- Filled critical empty fields:
Total,MerchantName, andFactdetails are mandatory for Skype to render the full card—empty values trigger the "icon-only" fallback. - Added
Priceto ReceiptItems: Skype's renderer relies on line item prices to display the item list; without this, it skips rendering the items entirely. - Added context-rich metadata: The merchant name, order number, and date help Skype's UI understand the card's purpose, ensuring it's displayed correctly.
Additional troubleshooting steps
- Test with the Bot Framework Emulator first: Confirm the card renders fully in the emulator before testing in Skype—this rules out general card structure issues.
- Avoid empty optional fields: Even if a field is marked as optional in the Bot Framework docs, Skype may treat empty values as invalid. Use placeholder text (like "$0.00" for tax) if you don't have real data.
- Check Skype's card limits: Ensure your
Itemslist doesn't exceed Skype's maximum allowed items (usually around 10—split into multiple cards if needed).
内容的提问来源于stack exchange,提问作者Dzmitry Tserakhau
相关产品推荐
相关产品推荐

