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

image

  • Add a workflow to the list using the “List Workflow” button (this button only shows if the workflow part of the screen is focused)

image

  • 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:

image

  • 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.

image

  • Add the “Call HTTP Service” activity

image

  • Setup the activity

image

  • Optionally: Set a status or similar on the sharepoint item (such as “Requested”)
  • In the end your workflow will look like this

image

  • 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

image

  • or create a custom action in the context menu to execute the script such as this example of a “remove license” action

image

Please don’t hesitate to post your comments or questions! More about this subject soon, if the interest is there! Smile

Merry xmas!


Comments (6):

  1. Divyadeep says:

    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

  2. […] OMS black belt Jakob also have great ideas about using SharePoint Online that I recommend, read it here […]

  3. remy says:

    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!

Leave a Reply