Post an image from a URL to a Teams Chat/Channel

Now I work for a company where timesheets are mandatory, and it’s become a repetitive chore chasing everyone to remind them to make sure their timesheets are up to date every Friday!

So being a fan of all things M365 and automation, I decided to automate this task with a simple Power Automate flow!

We start with a “Scheduled Cloud Flow” that will trigger every Friday (at whatever time you like)

Create your flow as per the image, and choose a day/time that is suitable for you

Next, add an “initialize variable” step. Give it a name, change the type to “Array” and provide the URLs to the images you wish to post in quotes and separated by commas:

Next add a “Post Message in a chat or channel” step. For this, I have had more success using Post as User, but you can try using Flow Bot if you prefer.

Hit the drop down to select Group Chat or Channel, then select the required options after that (For Channel, you will need to select the team and the channel, for Group Chat you will select the Group Chat from the list)

Click the icon shown here to change the message to source view:

You should now see something like this:

Delete the <p><br></p> and add this:

<p><img src=””></p>

Click in between the double quotes then select “Expression”:

Using the variable name, enter this into the box ( I used ‘images’, you could use pretty much anything you liked, it just has to match the name of the Array you created earlier on):

variables(‘images’)[rand(0,Ā length(variables(‘images’)))]

Click Ok, it should now look like this:

Save your flow and test it, you should now have automated your weekly reminder and learnt how to post an image to Teams from Power Automate!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.