Creating Power Automate (aka MS Flow) webhooks for Survey123 surveys in ArcGIS Online - Part 1

16515
15
11-08-2019 05:32 AM
zkovacs
Occasional Contributor III
10 15 16.5K

Update: Microsoft recently renamed Flow to Power Automate - link.

Starting with Survey123 for ArcGIS 3.0, webhooks can be set up and activated when a survey response is submitted. What does this mean? Basically, when a survey is successfully submitted, different workflows can be triggered based on the content of the submission: sending notification emails, adding results to a spreadsheet and so on.

There are a wide variety of workflow services available, such as Power Automate (aka MS Flow), Integromat, tray.io, Zapier, IFTTT, n8n.io, CloudHQ and the list goes on. Most (if not all) of them can be used to incorporate Survey123 as a trigger to build your automated process. Out of these, Integromat and Power Automate have a Survey123 connector making it easier to implement your processes. This article guides through an example using Power Automate.

What will you need to create Survey123 webhooks?

  • ArcGIS Online (AGOL) Organisational account
  • Your Survey123 form published into AGOL
  • Office 365 account to access Power Automate

Below is a workflow for creating a webhook that triggers an alert email if the submitted data meets a condition (for example the weather is Adverse).

1.  Open Power Automate (go to your O365 account and search for the app), go to My flows and click on + New > Automated - from blank :

2.  Give your webhook a meaningful name, so you know which one to edit/disable later if needed when you have more of them.

3.  Search for ‘Survey123’ under Choose your flow’s trigger, select When survey response is submitted and log in to your AGOL account (you only need to log in once, the connection is stored in your Flow profile). No alt text provided for this image

4.  Select your survey from the drop-down and click on New Step.

 No alt text provided for this image

5.  Choose an action: for example Condition

No alt text provided for this image

and add your survey field(s) and the value(s) you want the webhook to be triggered for. You can select your survey fields from the Dynamic content part for the condition:

 No alt text provided for this image

Under the If yes branch, add a new step (click on the ‘+’ sign) and search for Send an email (Outlook). Set up the required details and save your flow – use both Save buttons: one at the bottom and one in the top right corner! 

No alt text provided for this image

You should be able to see the webhook triggered on the webhook’s page under Runs

No alt text provided for this image

If you click on an item on the list, you can see the details of that run. You can use this to see if a run failed (and why). No alt text provided for this image

6.  Download your survey in the Survey123 app and test your trigger. If you downloaded the survey before the trigger was added, delete the survey and re-download it. Otherwise your webhooks won’t work.

In Part 2 we will discuss how to add the survey time to your webhook/flow and convert time zones.

15 Comments
About the Author
GIS specialist with over 20 years of professional experience providing consultancy, technical support, training and delivering high quality solutions and support for projects that have a requirement for spatial data interpretation and analysis. Main areas of expertise include (but not exclusively) data management, spatial analysis and modelling, cartography, desktop, mobile and web GIS, Python/ArcPy and webhooks with Power Automate/MS Flow. Former Esri Hungary and Esri UK staff.