Thursday, October 5, 2017

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.




0 comments:

Post a Comment