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)
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-1-5-1024x554.webp)
Select basic conversational bot to create a simple chatbot.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-2-4-1024x554.webp)
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.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-3-4-1024x554.webp)
After entering the details. Click on create. It will take sometime to create chatbot. After processing the chatbot will open.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-4-4-1024x554.webp)
Please wait until the message disappear (“creating your bot ………”)
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-5-4-1024x554.webp)
Select topics on the left side pane.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-6-3-1024x554.webp)
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.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-7-2-1024x554.webp)
Greeting topic is shown below.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-8-1-1024x554.webp)
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.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-9-1-1024x554.webp)
Rename the flow as “Displaying greeting image in chatbot”
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-10-1-1024x554.webp)
After renaming the flow. Select the “Add an output” and select Text.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-11-1024x554.webp)
Give the name of title as “Greeting Image”
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-12-1024x554.webp)
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)
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-13-1024x554.webp)
After saving of the flow. You will get success message. And after this we are going to add this flow in our chatbot.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-14-1024x554.webp)
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.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-15-1024x554.webp)
After adding the power automate to the chatbot. Select + icon to add node. Select show a message.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-16-1024x554.webp)
Select the variable in the dropdown.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-17-1024x554.webp)
After adding the message click on save.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-18-1024x554.webp)
You will get success message. (Topic saved)
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-19-1024x554.webp)
Type hello in the chat.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-20-1024x555.webp)
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-1-6-1024x555.webp)
Getting image as a response in chatbot.
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-2-5-1024x555.webp)
![](https://sainacloud.com/wp-content/uploads/2023/12/rsw_1280-3-5-1016x1024.webp)