Messages exchanged between a user and a bot can contain media such as images, video, etc. The Bot Framework SDK supports the task of sending rich messages to the user.
In this tutorial, you will learn the following.
- Design Hero Card and Response with Images.
- Design the Video Card and Response with Video.
- Build and Publish the Solution.
- Test your bot with Web Chat Client
Below are the prerequisites.
- The bot created in the previous article to help you understand the simple QnA Maker Bot
- Response card can be designed with different media response, i.e., Image & Video
Let's understand the architecture flow with respect to this article.

Primary bot communicates with the user through message activities.
To send a simple text message, use turn context object SendActivityAsync method to send a single message response. You can use SendActivitiesAsync method to send multiple messages.
- await turnContext.SendActivityAsync($"Welcome!");
To receive a simple text message, use text property of activity object.
- var responseMessage = turnContext.Activity.Text;
Some message activities consist of simple text and others may consist of richer context such as Cards, i.e., Hero Card, Video Card etc. Let’s start designing the cards.
Step 1 - Design Hero Card and Response with Images
Hero card allows you to combine images and buttons in one object, and send them to the user.
To process with rich card i.e. Hero Card, the below properties are required.
|
Type
|
Description
|
|
Tile
|
Title of the hero card
|
|
Sub Title
|
Sub Title of the hero card
|
|
Text
|
Text or Description need to display the below image
|
|
Images
|
Image URL which needs to be rendered
|
|
Buttons
|
Button with the click event, clicking allows the user to navigate
|
- public static HeroCard GetHeroCard()
- {
- var heroCard = new HeroCard
- {
- Title = "<<Title>>",
- Subtitle = "<<SubTitle>>",
- Text = "<<Secription>>",
- Images = new List<CardImage> { new CardImage("<<Image Path>>") },
- Buttons = new List<CardAction> { new CardAction(ActionTypes.OpenUrl, "Get Started", value: "<<Re-direct Url>>") },
- };
- return heroCard;
- }
QnAMaker Hero Card Response Design

Set Response design with Hero Card values.

Step 2 - Design Video Card and Response with Video
Video Card allow you to play video. Typically it's used to open a URL and stream an available video.
To process with rich card i.e. Video Card, the below properties are required.
|
Type
|
Description
|
|
Tile
|
Title of the hero card
|
|
Sub Title
|
Sub Title of the hero card
|
|
Text
|
Text or Description need to display the below image
|
|
Images
|
Image URL which needs to be rendered
|
|
Media
|
URL, i.e., video URL to stream any available video
|
|
Buttons
|
Button with the click event, Onclick allows the user to navigate
|





Join the conversation! Your thoughts help the community grow.