Select to view content in your preferred language

Getting Started with Feature Service Webhooks

4414
20
Jump to solution
07-14-2023 01:20 PM
ZachBodenner
MVP Regular Contributor

Hello, 

I've been excited to start working with webhooks to automate email communication. However, I need a little help. In the past, I've built a webhook in Power Automate to send emails when a survey 123 response is submitted, but I want to to use Feature Service Webhooks in 11.1 to track other things like updated/edited features. There are some parameters in the setup that I've been unable to figure out how to enter. For starters, the webhook creator in the server admin wants a hook url. How do I even find that? From what I understand, I create a webhook here, and then go in to power automate a figure out what to do with the payload, right? Is there a list of hook urls that I should have found somewhere?

0 Kudos
1 Solution

Accepted Solutions
KevinHibma
Esri Regular Contributor

That's good news Zach!

The blog you have is in invaluable walk-through if you're wanting to extract changes out of the extract changes API. There are some small differences between Online and Enterprise, but that blog for the most part should hold up. Looking at that sample JSON, that "required" section concerns me. I wonder if that is Power Automate's way of saying "if the incoming payload does NOT have those fields, send an error response back", and in turn, the webhook cannot create.

The benefit to supply a JSON schema into the HTTP request is received sets up the next connectors with what comes previously, basically making it easier to build up the flow.

If you want, try this JSON schema. This is specific to Enterprise Feature Service webhooks, without the required parameters. 

 

{
"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"
}
}
}
}
}
}

 

 

View solution in original post

0 Kudos
20 Replies
MarceloMarques
Esri Regular Contributor

This article can help.

Use webhooks to automate workflows in ArcGIS Field Maps with Power Automate (esri.com)

Also check the documentation.

Create webhooks—Portal for ArcGIS | Documentation for ArcGIS Enterprise

explains the parameters and the different methods to create webhooks.

I hope this helps.

| Marcelo Marques | Principal Product Engineer | Esri |
| Cloud & Database Administrator | OCP - Oracle Certified Professional |
I work with Enterprise Geodatabases since 1997.
“ I do not fear computers. I fear the lack of them." Isaac Isimov
0 Kudos
ZachBodenner
MVP Regular Contributor

Marcelo,

That first link is a good walkthrough - are there any notable differences that you're aware of when it comes to referenced feature services in Enterprise as opposed to Hosted Feature Services in AGOL? I'm still a relative beginner and I've gone through the second link you provided before but I find it lacking in the amount of detail I need to really understand what I'm doing.

0 Kudos
MarceloMarques
Esri Regular Contributor

There are some differences from AGOL and Enterprise, the Power Automate article shows the webhook for AGOL, but is a good article that explains the steps in Power Automate and also what the Hook URL is and how to find it.
- at the very end of the article...
"Paste the URL you copied from Power Automate into the HookUrl text box. This URL will be where ArcGIS Online sends information when features are created. Leave the remaining options alone."

| Marcelo Marques | Principal Product Engineer | Esri |
| Cloud & Database Administrator | OCP - Oracle Certified Professional |
I work with Enterprise Geodatabases since 1997.
“ I do not fear computers. I fear the lack of them." Isaac Isimov
0 Kudos
ZachBodenner
MVP Regular Contributor

Well, I'm giving it a try and I'm first running into trouble after completing the construction of Power Automate flow. I'm in my server admin attempting to create the web hook on the feature service, and I get the following error:

 

{
  "status": "error",
  "messages": ["Unable to create or update webhook. URL is not reachable: https://prod-31.usgovtexas.logic.azure.us:443/workflows/9fef558ef55b406fa6ef101e1f8510f7/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=kKoFso83fc2g1YNlMvm1-2T6AYONF_9fTSDqZj5xpMo for webhook <webhook>"],
  "code": 500
}

 Any thoughts on why that would be if Power Automate saved the flow successfully?

0 Kudos
KevinHibma
Esri Regular Contributor

Make sure the Flow has been turned on. If the Flow is off, the receiver is unreachable, thus you cannot connect to it.

0 Kudos
ZachBodenner
MVP Regular Contributor

That would've made me feel silly, but it's definitely on.

0 Kudos
KevinHibma
Esri Regular Contributor

If it's on, I've seen this happen once before and can't explain how it "fixed" itself. My suggestion is to turn the flow on / off (maybe Microsoft-Power Automate is in a bad state accepting incoming connections).

If that doesn't allow you to create it, delete your When an HTTP request is received from the Flow and bring a new one in, save, make sure it's on, and get a new URL.

 

In both cases, take the URL and paste it into a browser and see that it returns some response, probably like 

{"error":{"code":"TriggerRequestMethodNotValid","message":"The HTTP method for this request is not valid: expected 'POST' and actual 'GET'."}}
0 Kudos
ZachBodenner
MVP Regular Contributor

Alright, I tried both and neither solution did the trick. In both cases, I got an error identical to the one you provided.

0 Kudos
KevinHibma
Esri Regular Contributor

Interesting. If I use your URL, I get the same error. I did a little debugging/comparing to a PA url I have and outside of the webhooks, they function exactly the same, so I'm not sure what is different between the URL you have and the one I have.

Inside PA, what does your request body JSON schema look like?

Can you set it to something very basic, like:

{
    "type""object",
    "properties": {}
}
And ensure the method is either blank or set to POST?
0 Kudos