How to display images in power virtual agent-Power Platform

How to display images as a response in a power virtual agent


Problem statement

In Power Virtual Agent we can define the questions and answers (basic conversation). But we can’t use the image directly as a response.


Resolution

By using a simple power automate we can make possible for displaying image as a response in power virtual agent.

Create a simple power virtual agent using the following link. Https://make.powerapps.com

Select the environment you want to create a chatbot (power virtual agent).

Select chatbots in the left side pane (refer the attached image) and expand it

Select create to create a new power virtual agent (chatbots)


Select basic conversational bot to create a simple chatbot.


Enter the name you want to give for the chatbot. Select the language you want to use. And select the environment for the chatbot to function.


After entering the details. Click on create. It will take sometime to create chatbot. After processing the chatbot will open.


Please wait until the message disappear (“creating your bot ………”)


Select topics on the left side pane.


Select any one of the topic in the default or you can create your own topic by clicking on the “new topic” button on the top.


Greeting topic is shown below.


Select the + icon mentioned in the image. (to add node) select call an action and select create a flow in the option. A separate window will open to create a flow.


Rename the flow as “Displaying greeting image in chatbot”


After renaming the flow. Select the “Add an output” and select Text.


Give the name of title as “Greeting Image”

Second tab. Enter the following code.

![](publicly stored image URL)

For example – 

![](https://image.shutterstock.com/image-vector/okay-tire-character-cartoon-style-260nw-741955543.jpg)


After entering the output fields. Click on Save. (Make sure that there is no error in flow)


After saving of the flow. You will get success message. And after this we are going to add this flow in our chatbot.


Open the Chatbot we created in the beginning. And try to open Greetings topic. Select + icon to add node.

Select Call an Action and select the recently created power automate from the list.


After adding the power automate to the chatbot. Select + icon to add node. Select show a message.


Select the variable in the dropdown.


After adding the message click on save.


You will get success message. (Topic saved)


Type hello in the chat.



Getting image as a response in chatbot.