ArcGIS Enterprise

Dev Summit 2023: Automate workflows with service webhooks in ArcGIS Enterprise

ArcGIS Enterprise 11.1 introduces support for feature service and geoprocessing service webhooks. Service webhooks allow organizations to create automated and integrative workflows or modify existing workflows to be more efficient.

In their plenary demonstration, Lingtao and Bill explore the following ways an ArcGIS Enterprise organization using the Citizen Problem Reporter application can integrate the capabilities of service webhooks into their workflows:

Improve the request-to-work order pipeline using feature service webhooks

Since the Citizen Problem Reporter application provides community members 24/7 access to their city, the city needs to efficiently handle their incoming requests and submit accompanying work orders. Lingtao shows how the city can automate this process by integrating feature service webhooks into their workflow.

Creating a feature service webhook

Lingtao begins her demonstration by logging into the city’s ArcGIS Server Administrator API Directory to create a feature service webhook. She navigates to the feature service that powers the Citizen Problem Reporter app and creates a webhook that subscribes to the FeaturesCreated event trigger. A new feature is created whenever a new request is submitted through the reporter application, which triggers her webhook. Lingtao also sets the hook URL to point to the Power Automate Flow she created to act as the webhook receiver.

Figure 1: A feature service webhook resource page. The webhook, new_citizen_requests, is configured to trigger whenever a new feature is created.

Now that she has created her feature service webhook, any new request submitted from the app will trigger the webhook and prompt her Flow into action.

Automating work order submissions with Power Automate

Lingtao’s Power Automate Flow sets off a series of events whenever her feature service webhook is triggered:

  1. It fetches the edits made from the request
  2. It creates a new work order in Microsoft Dynamics in a Submitted state
  3. It sends a confirmation email to the submitter. The email contains information about the request and a link to check the work order’s status.
Figure 2: The Flow that kicks off whenever the configured feature service webhook is triggered. When the Flow receives the HTTP request (payload), the Flow will fetch the new features added to the feature service, and then prepare a new work order to be submitted to Microsoft Dynamics.

Testing feature service webhook integration

Now that she has created her feature service webhook, Lingtao needs to confirm that its integrated successfully into the city’s workflow. She switches over to the Citizen Problem Reporter application on her phone and submits a new request, reporting on a fallen tree blocking a hiking trail.

Figure 3: The submitted Citizen Problem Reporter request, with an attached image of a fallen tree on a hiking trail.

After submitting her request, Lingtao shows that a new work order matching her request was created in Microsoft Dynamics and that she received a confirmation email for her submission. Her feature service webhook is working properly and the organization can now efficiently submit work order requests. She hands her presentation off to Bill, who shows how the city can leverage geoprocessing webhooks to automate the quality control on incoming work orders.

Automate quality control using geoprocessing service webhooks

Community members can use the Citizen Problem Reporter application to submit non-emergency requests whenever, and wherever, they are encountered. However, there are instances where community members may report on a non-emergency occurring outside of city limits, or multiple community members may submit a report for the same event. With these factors in mind, the city requires a form of quality control to ensure each request is unique and actionable for the city’s field teams. Bill shows how he created a geoprocessing service and webhook to efficiently handle this work with no human intervention.

Creating a geoprocessing service

Before his demonstration, Bill created a Python script that performs two key functions:

Figure 4: A portion of the Python script Bill created, which checks to make sure each new request is inside city limits.
Figure 5: A portion of the Python script Bill created, which checks if the submitted work order is a duplicate of other received work orders.

He published this script tool as a geoprocessing service, which acts as the quality control for incoming work orders. Using a Power Automate Flow, this service runs each time a new work order record is inserted into the work order table.

Running the geoprocessing service

The Flow Bill created listens for new work order records being inserted into Microsoft Dynamics in a Submitted state. When a new record meets the criteria, the Flow runs the geoprocessing service.

Figure 6: The Flow for the geoprocessing service that, when a new work order record is inserted into the work order table in Microsoft Dynamics in a Submitted state, will run the geoprocessing service.

While this Flow helps automate quality control, the work order system needs to know when the geoprocessing job is finished so that the work order’s status can be updated. To do this, Bill needs to leverage the capabilities of geoprocessing webhooks.

Creating a geoprocessing service webhook

Bill created a geoprocessing webhook for his quality control service, which triggers whenever the quality control job finishes. He also created a second Flow to act as the webhook receiver. Whenever the webhook triggers, his second Flow parses the webhook payload for job information and updates the work order record with its proper validation status.

Figure 7: The Flow for the geoprocessing webhook. Whenever the Flow receives an HTTP request (the webhook payload) it will parse the payload for job information and will update the work order's status accordingly.

With the geoprocessing service and its webhook in place, the work order system is now fully prepared to automatically validate Lingtao’s work order.

Testing geoprocessing webhook integration

When Lingtao submitted her request in the Citizen Problem Reporter app, a new work order was added to Microsoft Dynamics. When this happened, Bill’s first Flow ran the quality control geoprocessing service. Once the quality controls checks were performed, Bill’s webhook triggered and his second Flow updated her record with its proper validation status. Now that this workflow has run its course, Bill can refresh the Microsoft Dynamics work order dashboard to show that Lingtao’s work order has its status changed to Validated.

Figure 8: A summary of the webhook process. New requests from the Citizen Reporter Application creates new features for the underlying feature service in ArcGIS Enterprise. Each new request triggers a feature service webhook that delivers its payload to a Flow that inserts a new work order records into the work order system. A Flow acting as a change listener recognizes these new records and starts a new quality check geoprocessing job. When the job completes, a geoprocessing service webhook triggers and sends its payload to a Flow that parses the job information and updates the record's status in the work order system.

Conclusion

In their presentation, Lingtao and Bill showcased just two of the countless ways service webhooks integrate into an organization’s workflow. We cannot wait to see how you will integrate service webhooks into your workflows in the years to come.

For more information on service webhooks in ArcGIS Enterprise, or to learn more about all webhook types that Enterprise supports, use the links below to explore our documentation:

Did you miss the other features showcased in today’s plenary? Do you want to revisit the demonstrations from our talented coworkers? You can find the links to other companion blogs in our Dev Summit 2023 overview.

About the authors

Tori O hara

Tori is a technical writer on the ArcGIS Enterprise team.

Lingtao is a Product Engineer for ArcGIS Notebooks. Her work focuses on notebook runtimes, web tools, and notebook samples. Prior to this role, Lingtao worked in Esri Technical Support as a subject matter expert in APIs and SDKs.

Connect:

Bill is a lead software development engineer on the ArcGIS Enterprise team, focused on ArcGIS Notebooks, security, Kubernetes, and framework development.

Connect:

Next Article

Tighten Up Your Edits with Editing Constraints in ArcGIS Online

Read this article