2. “Call an action” to your Power Virtual Agent and create the flow
In the conversation tree of your topic in PVA, select the Call an action node for Power Automate and create a new flow. In your flow, add in the action Initialize variable after the trigger. Set the following values:
- Name: randomgif
- Type: Array
- Value: Here you will need to paste in the URLs of your GIFs/images. They will need to be in the format of [“URL1”, “URL2”, “URL3”, “URL4”, “URL5”]
Expand Return value(s) to Power Virtual Agents. Click +Add output and select Text. Enter selectedgif as the title of the output. In the selectedgif output field, enter in the following: !(EXPRESSION). Afterwards, replace the word EXPRESSION with the following expression: variables(‘randomgif’)[rand(0, length(variables(‘randomgif’)))]. Save the flow and then return to Power Virtual Agents.
Note: You may need to type it out rather than copying and pasting it if you receive an error. Also, keep in mind that the expression should be in between () without any spaces.