Using Webhooks to keep up with your Flows

Workflow is something I use frequently in my work.  Emails, on the other hand, I try to avoid as much as possible.  So what's the best way to stay informed about the progress of your Flows?  I was looking for some innovative ways to stay informed without having to check in on the Flow status page or rely on emails and found that Webhooks do a good job at this.

Below is a simple example of a Flow that is triggered each time I upload a document to my OneDrive and asks for approval whether to keep it or not.  Maybe not the greatest example, but good enough to get the point across.  In this flow, there are two steps that I get notified:

  1. New document has been uploaded
  2. Document has been approved or rejected
For each of these events, I use an HTTP Action to POST a message to a webhook.  

Inside of each HTTP action, there are four properties

  1. Method:  POST
  2. URL:  The webhook URL that receives the notification
  3. Header:  Description of the type of notification
  4. Body:  The notification itself
In my example, I am posting the notification to a Microsoft Teams Channel.  You can find the details on how to do it in my article on Using Microsoft Teams to keep up with the Flow.  To post a message, all I needed to provide is the method, URL, and body.  Note that for all the notification messages, the method is always POST and the URL is the same.  The only property that changes is the Body.

I used some very basic formatting for my notifications to help visualize them better (yellow - in progress, green - approved, red - rejected).  You can get a full description of the HTTP messages in the Actionable message card reference.  Below is what the messages actually look like as they appear in the Microsoft Team channel.

Microsoft Flow Round-Up from Microsoft Ignite 2017

Hi all,

In case you didn't get a chance to attend Microsoft Ignite 2017, you can still catch the great sessions that were presented at the event.  Please note that some of the content is still being uploaded.

Session TitleLevelTopicAudience
Bring your sales team together: Office 365 Groups, Teams & Microsoft Dynamics 365 in the real worldFoundational (100)Usage & AdoptionIT Decision Makers
Learn how Dynamics 365, Office 365 and related applications work together to transform the workplaceFoundational (100)Usage & AdoptionIT Influencers & Implementers
Microsoft app-in-a-day with PowerApps, Flow and Common Data ServiceFoundational (100)Application PlatformIT Influencers & Implementers
Tackling Adoption Like A Service With Office 365Foundational (100)Usage & AdoptionIT Decision Makers
Administration and ALM best practices for PowerApps, Microsoft Flow and Common Data ServiceIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Automate workflows and enable modern approvals with Microsoft FlowIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Automate your Microsoft Dynamics 365 dayIntermediate (200)Usage & AdoptionIT Influencers & Implementers
Delivering simple and powerful serverless business applicationsIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Develop for the experience business with Adobe and MicrosoftIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Extend Microsoft Dynamics 365 to create custom solutions unique to your businessIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Extend the reach of your applications using the Business Application PlatformIntermediate (200)Application PlatformIT Influencers & Implementers
Learn how to deliver a compelling test drive experience on Microsoft AppSourceIntermediate (200)LOB ApplicationsDevelopers
Office 365 developer platform overviewIntermediate (200)ProductivityDevelopers
Quick wins with Microsoft Flow and PowerAppsIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Real world use cases: Custom solutions build with PowerApps,  Microsoft Flow & Common Data ServiceIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Securely transact business in Microsoft apps with Adobe Sign, the Microsoft preferred eSign solutionIntermediate (200)LOB ApplicationsIT Influencers & Implementers
Transform business process with SharePoint, PowerApps, and Flow for biz apps, forms, and automationIntermediate (200)ProductivityIT Influencers & Implementers
Transforming business processes into Microsoft PowerApps and FlowIntermediate (200)Usage & AdoptionIT Influencers & Implementers
Workflow Orchestration with Adobe I/OIntermediate (200)LOB ApplicationsDevelopers
Connect Dynamics 365 and business application data with Common Data Service for powerful resultsAdvanced (300)LOB ApplicationsIT Influencers & Implementers
Create custom forms and digital experiences in SharePoint using Microsoft PowerAppsAdvanced (300)LOB ApplicationsIT Influencers & Implementers
Deep dive: Compare SharePoint Designer and Microsoft Flow scenariosAdvanced (300)LOB ApplicationsIT Influencers & Implementers
Microsoft Dynamics 365 CE Platform Update for DevelopersAdvanced (300)LOB ApplicationsIT Influencers & Implementers
Unlock extensibility by connecting your service to PowerApps and Microsoft FlowAdvanced (300)LOB ApplicationsIT Influencers & Implementers
Deep dive: Advanced workflow automation with Microsoft FlowExpert (400)LOB ApplicationsIT Influencers & Implementers

Sending Custom Emails and Mail Merge using Flow

Many of us have used mail merge at some point in our careers.  I was recently asked to help create a SharePoint-based mail merge, where a unique emails gets sent to clients when the status of the client changed in SharePoint.  Depending on a status value, a different email message with personalized greeting would bet sent.  Here's how I leveraged Flow to get he job done.

Two SharePoint Lists

First, I needed to have two lists in SharePoint.  The first list contained the client information, including the status.  This list was used to trigger the flow.  Other information that was important in this list was the client's email address and name.

The second list was the email templates.  For this scenario, the templates contained two fields - the status that would be matched to the client's status and the body of the email, captured as HTML.

Building the Flow

The flow is broken down into three steps

  1. Trigger for starting the flow
  2. Getting the email templates
  3. Sending the correct email to the client

The flow is triggered when an item in the first list is changed.  As the trigger looks for any changes, you may inadvertently invoke the flow on any change.  To overcome this, you may want to consider watching for changes on the status field.  For example, create another field called Last Status and assign it the last status every time you save.  Then, all you need to do is see if the status field has changed.

In the second step, the Get Items action is used to get the email templates.  This control is not fully functional at this time, as the Filter Query is not working.  So instead of getting one specific email template based on the status, I had to get all of them.  What is important is to set the Maximum Get Count parameter to be larger than than number of email templates, or better yet, not set it at all.

This brings me to the third step in the flow.  Instead of simply sending the email template, I had to loop through all the templates until I found the template whose status matched that of my client.  When a match was found, the Send an email action was used to create and send the email.  It is not currently possible within a flow to replace parts of a string.  So, I had to leave the greeting of the email outside of the Email Body itself.

This process can also be used to create mail merges by reversing the process.  Instead of having a single user and multiple email templates, you could have multiple email recipients with a single email message.  You can even leverage this process for sending different messages to recipients as long as there is a way to identify who should receive what message.

I hope you find this useful.

Employee Check-in Simplified using Power Automate

Company employees who move between offices are often faced with a tedious process of having to check-in at the security desk to get a tempor...