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!
Merry xmas!
If the runbook requires parameters, have you tried posting them in JSON?
Example VM name to a start vm runbook or
vmname, servicename, osname and imagename to a create vm runbook
Hello
The dictionary that is send with the request is posted as JSON to the runbook and can be handles as mentioned in my other blog post.
http://blog.coretech.dk/jgs/azure-automation-using-webhooks-part-1-input-data/
you can add vmname etc here
[…] OMS black belt Jakob also have great ideas about using SharePoint Online that I recommend, read it here […]
Hi Jakob,
Your solution works perfect, thanks. I was just wondering if you could help me out. I would like to assign a button to the workflow/webhook, not entering a new row as in your tutorial. Is this possible? My runbook does not need any parameters. I really want to fire off the runbook with a button. Would be great for any assistense, thanks!
Hello Remy. yes it is possible, tak a look at custom actions in the sharepoint list. 🙂
it is oscause something that I can help you with as consultant at our hourly rate
Hi Jacob,
Thanks for sharing this useful article .
Is web hook available for SharePoint 2013 on-premises?