December 1st: Azure Automation: Triggering a webhook from a SharePoint workflow using Out-of-the-box Activities
Welcome to this year Coretech December Calendar!
Today is the 1st of december and we have a great little christmas treat for you!
This is the first post in a series of posts, published every day in December.
Today’s subject is Triggering Webhooks from SharePoint!
One of the great new features in Azure Automation is Webhooks!
Webhooks is everywhere! More and more cloud services support them.
Basically it is a simple HTTP Post sent to a web service that starts the runbooks.
We can then send a bunch of data with the post and have the runbook receive these dato.
For how to create webhooks look: See the official documentation here
For how to receive and process the input, take a look at my blog post here
This article will discuss how you can easily trigger one of these webhooks directly from a SharePoint workflow, either from on-prem or SharePoint Online!
Here’s how it goes:
- Logon to SharePoint
- Find the list you want to use for the workflow
- Edit the list in SharePoint Designer
- Add a workflow to the list using the “List Workflow” button (this button only shows if the workflow part of the screen is focused)
- Choose Sharepoint 2013 or 2010 workflow (So far I have only tested with Sharepoint 2013, but will update soon)
- Name the workflow whatever you like
- Now you are ready to design the first stage in the workflow:
- What we need is a Dictionary to populate the runbook input with values from the list item, a dictionary for headers and a call to the webhook.
- Add a “Build Dictionary “
- Add Any of the value from the List item (or other sharepoint value or fixed values) to the dictionary. These will be sent as inputs to the runbook.
- Add the “Call HTTP Service” activity
- Setup the activity
- Optionally: Set a status or similar on the sharepoint item (such as “Requested”)
- In the end your workflow will look like this
- Now is the time to set the workflow to an action.
- Go back to the workflow settings at set one of “start workflow automatically” settings
- or create a custom action in the context menu to execute the script such as this example of a “remove license” action
Please don’t hesitate to post your comments or questions! More about this subject soon, if the interest is there!