How can you make chatbot conversations feel more like you’re talking to an actual person? One way is to have your chatbot send random GIFs to users to add a bit of variety and spontaneity to conversations. Using Power Automate and Virtual Agents, you can set your chatbot to send GIFs from a selected collection. Here’s how you can do that:

.

1. Collect the URLs of the images and GIFs you will use 

You will first need the URL of the images or GIFs you would like to use. When the flow is run, one will be randomly selected and posted to your bot. You can get sample GIFs from this website: https://giphy.com/sunnyfxx/. To get the URL, you will need to right-click on the image/GIF and select Copy image address.

.

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.

.

3. Connect your flow to your topic

Going back to your PVA topic, add the flow you just created into the conversation. Add a new message node underneath, and within the message node, insert the selectedgif variable. Afterwards, your chatbot is now ready to test. Save your topic and test it!

Learn how to create low-code, no-code conversational virtual agents

There are many more ways to add variety to chatbot conversations. If you want to learn more about how your organisation can maximise low-code, no-code conversational chatbots, Barhead offers Power Virtual Agents in a Day. During this instructor-led hands-on workshop, you will gain first-hand experience in designing and developing a virtual agent using a no-code graphical interface. To learn more about Barhead’s Power Platform workshops, visit our website.

About the Author: Rishona Elijah 

Rishona Elijah is a Microsoft MVP and is one of our Power Platform experts at Barhead Solutions. She is also a Microsoft Certified Trainer who runs regular training and events and is passionate about empowering business users to realise the potential offered by Microsoft Solutions. Her focus is on showcasing how you can leverage the Power Platform to transform your business.