ArcGIS Online Hosted Feature Service Notification on new record/feature added

13353
39
02-11-2015 09:26 AM
Status: Open
KyleJohnson
New Contributor II

Add the ability to trigger a notification (to a specified e-mail address) when a new record is created in a hosted feature service though ArcGIS Online. This would be most beneficial when leveraging the GeoForm application for collecting information from the public. A bonus ability would be to initiate notification to different e-mails depending on a specific attribute. (For example, the GeoForm has a drop down menu (generated from a domain) for "Problem type", with the options "Pothole",  "Tree Issue", etc. If the "Pothole" problem is chosen, then the email notification would go to the street department, if "Tree Issue" is chosen then the notification would go to the Urban Forester).

39 Comments
KhaledHassen

Hi Ben,

Webhooks will be released on online June release (sorry for the delay). Documentation will be ready as well with the June release. 

All the dev summit sessions are available. Pl. check the feature service session - ArcGIS Online: Best Practices with Hosted Feature Services - YouTube 

Thanks

Khaled

HelderVieira

Hi Jeff,

Can you share what changes you made to get this script to work for you.

I'm trying to modify the where clause, without success.

thank you

Tolo__AdamTolo

Correct me if I am wrong here but I thought Webhooks were only for the admin tasks.

Eg. You can't monitor if there is a new feature added, only if a whole item is added to a group?

KhaledHassen

Pl. note feature service webhooks is not related to webhook on the item level.

Yes webhooks is only available on admin API where you register a callback url with the feature server. Feature service will call you back to notify you with any feature service changes and allow you to fetch these changes.

We have add a finer webhooks interface that tracks adding/update/delete features and attachments and also any schema changes. Webhook doc will be release in June.

Thanks

Khaled 

Tolo__AdamTolo

Thanks for the clarification

Kara_Shindle

This is the first script I've been able to modify & get it to work successfully.  Thank you for sharing this!

Kara_Shindle

So I am working with this script, and a strange thing happened.  I haven't touched the f-strings in the sendInternalNotification function.  The script worked about 3 times, and now I get a "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'" for the first line in the msg variable.  I'm using 3.6.4.  If I wasn't using Python 3.6, I'd expect this since f-strings weren't introduced until 3.6, but I cannot figure out why the script suddenly stopped working when it had worked previously.

MatthewMuehlhauser

Kara, I believe that your error would be occuring at this line in the code:

 f"Date Submitted: {datetime.datetime.fromtimestamp(int(submittedOn)//1000)}{sep}"

I can think of a couple of obvious things could have caused this.

1. You no longer have a submittedOn field

2. You have an entry with either a null value or another value that cannot be converted to an integer.

I'm leaning more towards number 2 though.

BenWalker

Did webhooks for the edits make it into the June release? I have had a look and cannot see anything?

KhaledHassen

Yes we did release it yesterday.

Blog url: https://www.esri.com/arcgis-blog/products/arcgis-online/sharing-collaboration/how-to-create-a-hosted... 

Will be available tomorrow.

Just enable changeTracking in your service and you should see creating a webhook in the service admin url.

Thanks

Khaled