Create and Send Hero Cards in your Proactive Message / Notification to Teams Bot using C# Console App

Create and Send Hero Hero in your Proactive Messages or Notifications to Microsoft Teams Bot using C# Console Application using Microsoft Bot Framework v4.

Hero cards or any attachments are the files that we wish to add along with the message in Chatbots. These help a better understanding of the message.

Hero cards contain the same information as thumbnail cards, just with a larger or more pronounced layout for the card images.

Source Code

If you want the source code for this console application, visit the JD Bots Repository. Else, you can follow the blog.

//As defined by Microsoft Documentation

Constructors

HeroCard(Session)Creates a new HeroCard.

Methods

buttons(ICardAction[] | IIsCardAction[])Set of actions applicable to the current card. Not all channels support buttons or cards with buttons. Some channels may choose to render the buttons using a custom keyboard.
images(ICardImage[] | IIsCardImage[])Messaging supports all media formats: audio, video, images, and thumbnails as well to optimize content download.
subtitle(TextType, any[])Subtitle appears just below Title field, differs from Title in font styling only.
tap(ICardAction | IIsCardAction)This action will be activated when a user taps on the card. Not all channels support tap actions, and some channels may choose to render the tap action as the title link.
text(TextType, any[])A text field appears just below the subtitle, which differs from Subtitle in font styling only.
title(TextType, any[])Title of the Card.
toAttachment()Returns the JSON for the card

Prerequisites

We have already written a blog to send text messages proactively in our last blog. We will continue from the last blog to send the Hero Card in a Proactive Message or Notification.

Send Hero Card in Proactive Message or Notification to Teams Bot using C# Console Application

Add the following method to send the Hero Card as a Proactive Message or Notification to Microsoft Teams Bot using the C# Console Application.

Add the following code in the main method to call the above SendHeroCardToUserAsync method.

Video: Send Proactive Message / Notification to a single user in Microsoft Teams Channel using C# Console Application

Thank you All!!! Hope you find this useful.


Up ↑

%d bloggers like this: