Automate your workflow with Microsoft Power Automate
Tags: devops, azure, automation, tutorial
Published: 2021-07-12 16:50:41

The most tedious part of development is doing the same tasks over and over again. Don't you feel bored having to mention someone on Slack when they get assigned a Github Issue, or having to send an email to your newsletter when you post a tweet.

Sure, you can setup integrations, webhooks and CI jobs to do these tasks, but they're often tedious, require signups to hundreds of services, and all of them might not have the same steps.

Enter [Microsoft Power Automate](https://flow.microsoft.com), also called Microsoft Flow, which allows you to automate almost everything in your tech stack. Want to send a message on Slack or Teams, sure, want to SMS a number with Twilio, you can do that too. It also has many listeners, like when a new Tweet is posted, or when a Github Issue is assigned to you.

In this tutorial, we'll take a look at how we can automate a few common tasks with Microsoft Flow.

## Prerequisites

- An Office365 Microsoft Account
- Accounts for the services we'll be automating (Github, Slack, etc).

## Flow 1 - Mail me when a Github Issue is assigned to me

First, create a new Automated Cloud flow and give it a name.

Add the `When an issue is assigned to me` trigger from Github. You will now be asked to sign in to Github, which you should do.

Next, add the `Mail` action, which uses Sendgrid under the hood.

![How your flow looks](https://i.ibb.co/XbgBN01/Screenshot-from-2021-07-09-14-48-42.png)

> You can notice that I've added some dynamic elements that were provided to me by the Github Trigger.

You can add more things to your flow, for example, add an item on Microsoft Todo, create a Trello card, or message yourself on Slack.

![Added a Todo action](https://i.ibb.co/g4DGNVs/Screenshot-from-2021-07-09-14-53-15.png)

Click `Save` when done, and you will now be emailed whenever an issue's been assigned to you!

## Flow 2 - Post your website's status to your Twitter everyday at 6 AM

Create a Scheduled Cloud Flow, since this event is based on time.

Make sure the date is set to this date, and the time is set to `6:00 AM`.

Also set the task to repeat every 1 day. See the below image if you get confused.

![Flow creation dialog](https://i.ibb.co/0Bf8qqL/Screenshot-from-2021-07-09-14-58-28.png)

Add a HTTP action that'll query your website's status page. My website uses Cachet to display its status, so I'll tailor my flow to Cachet's API response.

![HTTP action](https://i.imgur.com/Lbm4ZML.png)

Next, you need to parse the data down to access the `status_name` field in the JSON response. 

![Data actions](https://i.imgur.com/PwNrtPK.png)

Finally, you can tweet out the status of the website. You'll need to sign in to Twitter for this flow to work.

![Tweet action](https://i.imgur.com/HujqhpF.png)

Click `Save` when done, and now, at 6 AM daily, your followers will be notified of your website's status.

## Conclusion

See how easy it is to automate the small things? The best part is that Microsoft Flow is included with the Office365 subscription, so along with Excel, Word and PowerPoint, you also get this monster of an automation tool that really, nobody cares about! So go ahead and share this article with your friends, so they can also use this wonderful tool.