Enabling webhooks and Fetch Updates for ArcGIS Enterprise 11.1 (Preview)

2015
13
09-18-2023 07:30 PM
AnthonyLatini
Esri Contributor
1 13 2,015

Configure layer in ArcGIS Enterprise to allow editing

 

To begin, you must enable the feature layer to allow editing. If the layer does not have these options enabled, the webhook and updates will not work.

  1. Log into your ArcGIS Enterprise portal
  2. Navigate to the location of your feature layer and select it

AnthonyLatini_0-1695090413822.png

 

  1. Select the layer that you want to enable editing on

AnthonyLatini_1-1695090413830.png

 

  1. Click Settings from the ribbon

AnthonyLatini_2-1695090413843.png

 

  1. Scroll down to the Feature layer (hosted) section and enable the following options under Editing:
    1. Enable editing
    2. Keep track of changes to the data
  2. Under the What kind of editing is allowed section, enable the options applicable to your flow
  3. The settings will save automatically

AnthonyLatini_3-1695090413873.png

 

Configure trigger (automated cloud flow) in Power Automate

Next, we need to configure the trigger in Power Automate to obtain the HTTP POST URL. In these steps, a flow will be configured to listen for changes to the feature layer.  

  1. Create a new automated flow
  2. Name your flow and then select Skip
    1. The following trigger is not in the auto-generated list when creating a flow
  3. In the Flow editor, search for the following trigger and select it:
    1. When an HTTP request is received

AnthonyLatini_4-1695090413923.png

 

  1. In the Request Body JSON Schema, paste the following JSON into the field:

 

{

    "type": "object",

    "properties": {

        "serviceType": {

            "type": "string"

        },

        "changesUrl": {

            "type": "string"

        },

        "name": {

            "type": "string"

        },

        "id": {

            "type": "string"

        },

        "folderName": {

            "type": "string"

        },

        "serviceName": {

            "type": "string"

        },

        "events": {

            "type": "array",

            "items": {

                "type": "object",

                "properties": {

                    "eventType": {

                        "type": "string"

                    },

                    "when": {

                        "type": "integer"

                    }

                },

                "required": [

                    "eventType",

                    "when"

                ]

            }

        }

    }

}

 

  1. Add a new action and search for the ArcGIS Enterprise connector
  2. Under the list of actions, select Fetch updates, changes, or deletions from feature layer (Preview)

AnthonyLatini_5-1695090413967.png

 

  1. In the Get changes from field, select the chnagesUrl from the dynamic content list

AnthonyLatini_6-1695090413996.png

 

  1. Select the layer that is needed for the webhook flow. This should be the same layer you edited in the first section of this walkthrough.

AnthonyLatini_7-1695090414012.png

 

  1. By default, all the options that can be used as trigger are set to true. You can change these options based on the type of flow you are creating.

AnthonyLatini_8-1695090414021.png

 

  1. Save the flow. After saving, the trigger will autogenerate a URL. This URL is needed for the next steps and configuring the webhook in ArcGIS Enterprise.

AnthonyLatini_9-1695090414042.png

 

  1. After saving, you should have a flow that looks like this:

AnthonyLatini_10-1695090414110.png

 

  1. Keep this tab open as the HTTP POST URL will be needed for configuration steps in the Enterprise organization

 

Configure feature layer with webhook URL

 

This section will go over the steps necessary to create a webhook on the feature layer you are using for your flow.

 

Prerequisite: You must be signed in as an administrator on the Enterprise organization to process the next steps.

 

  1. Navigate to the following URL:
    1. https://organization.domain.com/server/admin/login
  2. When the page loads, you should see the following screen:

AnthonyLatini_11-1695090414134.png

  1. In a new tab, open the following page:
  2. https://organization.domain.com/portal/sharing/rest/generateToken
  3. The following page appears:

AnthonyLatini_12-1695090414148.png

  1. Type in the administrator’s username and password
  2. Under the Client section, ensure that Wepapp URL is selected and type in the following URL format:
    1. https://organization.domain.com:443/server/admin
  3. Set the expiration to any of the options in the dropdown. The default is one hour.
  4. Once all the fields are filled in, press Generate Token
  5. Copy the Generated Token from the new field that appears

AnthonyLatini_13-1695090414150.png

 

  1. On the previous page/tab, paste in the newly generated token to the Portal token field
  2. Press Login

AnthonyLatini_14-1695090414151.png

  1. Once logged in, select Services from the list of resources

AnthonyLatini_15-1695090414157.png

 

  1. Select the appropriate folder where the feature layer is stored. By default, this should be under the Hosted category

AnthonyLatini_16-1695090414161.png

 

  1. Select the service you want to add the webhook to

AnthonyLatini_17-1695090414164.png

 

  1. When the new page loads, scroll to the bottom of the page
  2. Select webhooks

AnthonyLatini_18-1695090414167.png

 

  1. From the Supported Operations section, select create

AnthonyLatini_19-1695090414170.png

 

 

  1. On the Create Webhook page, fill in the appropriate information to create the webhook
    1. Name: Name the webhook. It is recommended to name this something meaningful to keep track of the webhooks
    2. Changes type: By default, a “*” (wildcard) should be entered to retrieve all the changes on the layer. You can specify which changes you’d like if you do not want to capture every action made against the layer.
      1.      AnthonyLatini_20-1695090414172.png

         

    3. HookURL: This is the URL that was generated from the Power Automate automated flow. Paste the value from the trigger into this field.

AnthonyLatini_21-1695090414180.png

 

AnthonyLatini_22-1695090414182.png

 

  1. After pasting the URL, click Create
  2. The webhook has been successfully created

AnthonyLatini_23-1695090414185.png

 

 

Create a flow to test the webhook on the feature layer

 

Now that the webhook has been created, we can run a simple test to see if the webhook is listening and capturing changes as expected. A simple test for this is to add a new attachment to a feature layer.

  1. Create a new Instant Cloud flow from your Power Automate landing page
  2. You can name the new action; however, it is not necessary. This action is meant as a test to see if the webhook is working and can be deleted after the test.

AnthonyLatini_24-1695090414223.png

 

  1. Add a new step and search for the ArcGIS Enterprise connector
  2. Select Add attachment from the list of actions

AnthonyLatini_25-1695090414249.png

 

  1. In the action window, select the layer that contains the webhook
  2. For Record ID, type in an ObjectID or unique identifier from your feature layer. You may need to show this column in your data table

AnthonyLatini_26-1695090414268.png

 

  1. For Attachment name, type in:
    1. webhooktest.txt

AnthonyLatini_27-1695090414270.png

 

  1. For File content, type in:
    1. This is a test.

AnthonyLatini_28-1695090414271.png

 

  1. Save and test the flow
  2. After the flow runs, the Run History should show that it succeeded

AnthonyLatini_29-1695090414273.png

 

  1. Open the Webhook flow to see if the webhook was trigger correctly
  2. The Run History should also show a new entry and the webhook process should be successful

AnthonyLatini_30-1695090414275.png

 

 

13 Comments
S_RossWygmans_GISS-T
New Contributor II

I'm trying to set up a Power Automate flow so that whenever a feature is added or updated within a hosted feature service in our Enterprise environment, a message is sent to a Slack channel notifying our team of the update and providing attribute information about the feature. In this case, I'm trying to include the Facility Identifier attribute of the created/updated feature in the body of the Slack message. 

S_RossWygmans_GISST_0-1697031147521.png


However, I keep getting the following error whenever I try to extract attribute information about the feature. 

S_RossWygmans_GISST_1-1697031251078.png

 

 

BradyWalker2
New Contributor II

When I select Fetch updates, changes, or deletions from feature layer (Preview) I get a window that looks different than the one above. It asks for my Enterprise URL, Client ID, and App Secret. Am I doing something wrong / where do I find the appropriate Client ID and App Secret?

PA_ArcGIS.png

S_RossWygmans_GISS-T
New Contributor II
BradyWalker2
New Contributor II

@S_RossWygmans_GISS-T

Thank you for the link. However, after entering the enterprise url, client id, and app secret I get an invalid redirct_uri error. Any idea what could be causing this? PortalLoginAttempt.png

AnthonyLatini
Esri Contributor

Hi @BradyWalker2 - for this issue, you will need to add this application ID to your ArcGIS Enterprise URI settings. This is typically done from the Administrator's portal (backend). 

What version of ArcGIS Enterprise are you running? I have seen this happen on earlier versions of ArcGIS Enterprise, but not so much on 11.0 and above. 

Let me know if you have issues configuring this on the admin pane. 

For reference and where to begin: 

  1. Open a new browser tab and enter the Portal Administrator Directory URL (https://<domain>/<webadaptorname>/portaladmin).
  2. Click Login and sign in as the portal administrator user.
  3. Click Security > OAuth > Update App Info or Change App Info.
AnthonyLatini
Esri Contributor

Hi @S_RossWygmans_GISS-T ! Could you send me an email directly with your post so we can troubleshoot this? 

 

Email: alatini@esri.com 

 

Thank you! 

BradyWalker2
New Contributor II

@AnthonyLatini I'm running version 10.9.1. When I get to the Update App Info page in step 3 I see "App Info (in JSON format)". Where do I get the JSON formatted info?

AnthonyLatini
Esri Contributor

@BradyWalker2 - In most situations, this would be the typical format when setting this up. As a note, 10.9.1 is not officially supported in this component, however, once you configure these settings, it should work correctly. 

Let me know if this helps! 

{
    "appId": "YOUR APP ID",
    "redirectURIs": [
        "http://*.arcgis.com",
        "https://make.powerautomate.com",
        "https://global.consent.azure-apim.net/redirect",
        "https://*.esri.com"
    ]
}

 

BradyWalker2
New Contributor II

Hey @AnthonyLatini,

 

That worked! Thank you so much for your help. I have another question. I don't see a webhooks option on my feature layer resources. Is this because I'm using version 10.9.1?Resources.png

AnthonyLatini
Esri Contributor

@BradyWalker2 - Awesome! I am glad that worked. That is correct. Beta support for webhooks starts at 11.1 and above. 

Clayton-Cooley
New Contributor III

Followed the instructions but I'm getting the following error when trying to select a Feature layer:

"Could not retrieve values. The dynamic invocation request failed with error: { "error": { "code": 400, "source": "unitedstates-002.azure-apim.net", "clientRequestId": "fb8f6ff3-0fa1-4ba1-ad65-a7845eea96b6", "message": "The response is not in a JSON format.", "innerError": "Cannot read properties of undefined (reading 'forEach')" } }."

FrancisHourigan1
Occasional Contributor

@AnthonyLatini Will the workflow documented not work with a hosted feature layer that is created with Survey123 because the "Keep track of changes" is not accessabile becasue you need to overwrite the feature when updating the survey...? Is there a workaround for creating a webhook to email me when a survey has been submitted?

ZachBodenner
MVP Regular Contributor

@AnthonyLatini , does this workflow (and all Enteprise Connector triggers) only work with hosted feature layers? I'd like to use Power Automate to enable notifications of updates on referenced feature layers.