Using Webhooks in ArcGIS Enterprise

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so yeah we're here to talk about webhooks a new capability and arches enterprise 10-7 the agenda for today so we'll start off by just talking about what a webhook is what are the advantages of implementing a webhook we'll go through some key terms and then the demo will help help you understand you know how you can start using them with your daily workflows so you saw this yesterday in the plenary this idea of don't call us we'll call you and that's essentially what a web hook is so let's say I need to drop my car off at the mechanic and I want to find out when it's ready to be picked up I can either keep calling the mechanic and say hey is my car ready to be picked up and he'll either say yes it is or it's like he'll say no and depending on his answer I'll have to keep calling him back until you know he has the answer I'm looking for and so this is the idea of polling you're continuously asking the system for information waiting for it to reach a certain state alternatively the mechanic can say hey Joel you know go about your day you don't have to call me I'll call you when your car is ready and that's what a web book is it's this idea that when something happens in the system the system will let you know and so this is a new capability in ArcGIS Enterprise that's going to allow you to provide other applications with event-driven information and that information is delivered as an HTTP request sent as a post and you can use web hooks to create automated and integrative workflows and this creates new extensibility in ArcGIS Enterprise so kind of looking at this diagram we have our users interacting with portal and so they're adding items they're sharing items they're creating groups and let's say you create a web hook to subscribe to one of these events and so a user shares an item and that triggers the web hook once triggered portal will send out the payload to a web book receiver that you've configured and from there you know the world's your oyster you can use that to post process you can use it for operational intelligence or you can integrate it with other systems and other workflows [Applause] so what are the advantages of using web bugs so thinking back to the first story it's more efficient than polling of course you don't need to keep asking the server for information the server will let you know once it has that information and so this allows you to create event-driven workflows that you can integrate across multiple systems and so this is going to give you new and more efficient opportunities for automation and so the scope for 10-7 so web hooks can be created updated and deleted by portal administrators via the ArcGIS portal directory also known as the sharing API so what that means is there's no UI or UX for this in the home app you have to go through the sharing API as an administrator to create a web hook and you can also create and manage your web hooks using the ArcGIS API for Python web hooks can be created to subscribe to events pertaining to items users and groups and portal for ArcGIS and for 10-7 these events are primarily create update and delete type events and then the REST API dot was updated to documented resource and so there are some key terms that we're introducing with web hooks the first is trigger event so this is the operation that is going to trigger your Web book so for example I can create a web book that is triggered anytime an item is updated in my organization or when the item is shared and your web hook can have more than one trigger event so all of our trigger events are listed in the documentation so you'll be able to see it there but kind of looking at this we at the top we have slash items so it's following this URI pattern and so this is going to give me all of the events below pertaining to the items in my portal but I can narrow it down from there I can go to a specific item by specifying the item ID or I can go to an operation on a specific item so if we look at the bottom of the list I can narrow down to listen to a specific item being shared so anytime a specific item in my portal is shared my web hook is triggered and then users and groups follow a very similar pattern so we have high level user events so that's giving me all of the events for my users one thing to know you see we have user name slash update that's not an update to the licensing right now it's just an update to the user's profile and then similar with groups you can listen to all events for all groups or narrow down to a specific group and the update operation so these are updates to the group's properties or the user's profile or the items properties next key term is the payload so once the web book is triggered a payload is delivered to the specified payload URL in JSON format and each event will follow a similar jason and json schema as you see so I won't go through all of this but we have some high-level information about the web hook at the top under info and so that gives us the U of the portal that the web hook was delivered from and a timestamp as well as we have some information about the events so we can see here that an item was shared by a user named admin and it was shared to everyone and to a specific group specified by the group ID and so these payloads are intended to be thin if there's more information you need the ideas you'll call back into portal to find that information out and then we have the payload URL so this is where web hooks become fun so this is where you send your payload to and all payloads must be delivered through HTTP POST and so that means your web hook receiver must must be configured to communicate over HTTP and be reachable by the portal and so there are a number of options for how and where web hook is received we included a sample in the enterprise SDK for 10-7 which is a Java servlet you can also use third-party services which we'll look at in a bit like Microsoft flow zapier IFTTT and then there are also custom web servers that you can build yourself such as nodejs and python class okay Sona Lika why don't you tell it tell us what we can do with this okay thanks toil so all of our toil described sounded like a Dell workflow but if you are an admin you can still take advantage of the web books to create automated workflows without coding we have two demos lining up for you first one is a simple workflow and the other one is a bit complex workflow so let's assume that we have some we have a group with some sensitive data in a box is portal and administrators and group owners want to be notified anytime an unauthorized user is added to this group and in this demo we are going to show you steps on creating of a book and we'll show you how to trigger your webhook when a user is added to a specific group and we'll show you how to configure the Microsoft flow so that how can you notify the the admins via slack channel right so this is this is the group that that we have with the some sensitive data and we're gonna need the group ID some Doyle is going to copy that group ID and with the group ID we are navigating to the ArcGIS portal directory make sure you are login as admin because as we mentioned that means can only be managed can only be managed by books once you logged in click on the oak ID link and scroll all the way down under the child resources you click on the web books link here we are displaying all the web books that has been created so far and the under the supported operations click on create web books and out of this parameters name payload URL and event mandatory while the secret and the configuration properties optional secret is a user-defined text you could add and we will we will add that to the payload and you can use that secret to verify the sender on the receiver side and we have defined the deactivation policy here which will tell portal when to deactivate of web book in case of failure so if there is multiple failures it will be automatically deactivated so before we go further you're gonna configure the payload URL and jointly is going to do that with Microsoft flow okay so as an elite I promise you can take advantage of using web hooks without any code and so Microsoft flow is a service provided by Microsoft that allows you to create build these workflows they have integration with tons of applications I'm just curious there might be some people who have already used web hooks with so every one to three how many of you are familiar with Microsoft flow for creating web books ok so a good number of you so this will be new for some folks so essentially I'm going to create a workflow I'm going to create it from blank and the first thing I need to do is define how my workflow is triggered and so in this case the workflow is going to start once portal sends out that HTTP request and so I'll just search for that action or the trigger okay and so we have when HTTP HTTP request is received I'll click on that next I need to provide a sample JSON schema and so that way I can build my workflow off of this schema that I anticipate receiving and so luckily in our help documentation we've included a schema down here so I'm just gonna copy that and paste it next so we want to know what user is added being added to the group so we can verify whether they're an authorized user and so we have some additional properties that are included in the payload one of those additional properties is the username that's added to the group and so we have a list here of all of the additional properties and so I'm just going to copy that and you know make sense in a second why I'm using this okay next I'm gonna add a step so once I receive my payload what I want to do I'm gonna add a condition and because I provided my schema I can now create a dynamic condition based on the the keys that I'm receiving so I want to know does my username contain admin so let's say the only person that should be added to this group their username is admin if yes do nothing if not let's send a message to slack so great advantage of using a service like Microsoft flow is they have tons of integration with applications so it's quick and easy to to get started I'm gonna post a message and I'm gonna send it to a channel where all my managers are listening I'm gonna say hey managers the following user and I can pull data from my payload was added to this group and I'm pulling the group ID but is not authorized you should do something about this okay and so that's it I'll hit save once I hit save I'll have a payload URL that I can use and I'll switch back over to Malika to finish this off so try great so we have the payload URL next thing what we wanted to do is find out the event as we mentioned they want our books to be triggered whenever you say is added to a specific group so let's navigate back to the help document and see whether we have us event that we could use so under the group we see that add users event is supported we're gonna use that copy that and gonna replace our group yeah group ID is now a group ID right so now we have everything are ready to create the web book when we hit the create where book button behind the scene portal is going to ping that payload URL just to make sure that it can be reachable otherwise you won't be able to create the web book so you can see that it's successfully created and if you go back to web books link you should be you can see the new wave book that we just created so we have the web books now let's navigate back to the portal and add the add a user not an authorized user to this group so that we can see a message in the slack so we're gonna use that members method because that's what we have subscribed to okay okay so yeah so we have we have the message saying that the user is unauthorized and it says been added to our group right so just like that we use a third party tool to automate a simple workflow using my books you can take advantage of similar services like IFTTT or say peer to achieve similar workflows okay so for developer come a community like you guys this new capability will Vella allows you to extend the arcgis enterprise portal in new creative ways it Enterprise SDK 10 server we are shipping a sample of the book receiver application and this receiver can receive incoming web book payloads and simply write to a file and can be deployed into a Java servlet container like Apache Tomcat you need to make sure you enable the SSL because we only support the the HTTP traffic so let's look at our second scenario and our organization has such standards for example for any items shared to the public and they want to automate the workflow so that when these standards are not met inform the admins and these standards could be whether the item has enough tags or enough description or whether it meets the item completeness code but supper so let's quickly take a look at this workflow user shares an item to the public and the payload is sent out and this payload is received by the Java servlet and writes through the file and using the Python API for ArcGIS are going to do a call back to the portal and examine the item properties and check for these standards if these are not met you're going to inform the the managers we are select channel and managers can take action like they can unsure or they can even add the appropriate tags so less so if you install the ArcGIS Enterprise SDK you can see this sample receiver application under samples it's called under the Java it's called webbook listener and if you're familiar with the Java you can see that this is a simple servlet listening to a post request and it just process it and writes to a file so we have already deployed this sample application in Tomcat server and right now it's listening on my what eight four four three and also we have a fare book created for this purpose and it's listening to all Lytle changes so whenever item is change change it will trigger to get an event so less since we have everything now Doyle is going to share an item to public and show a more custom okay so this is our item we can see it has an incomplete description doesn't really have all the tags that should have and it's probably not ready to be shared out to the public but the user does it anyways and so this is gonna trigger the webhook and that webhook is going to fire off our Python script Python script is going to receive this payload it's gonna analyze the item by calling back into portal and checking these properties it's gonna look at the description it's gonna look at the tags it's gonna tell us whether this item was actually ready to be shared to the public or not and so we got a message in slack and so we had this little slack admin bought and it tells us the following item was shared to the public but does not meet all of the requirements and I can see why so the item was missing the following tags the description was not long enough and the score completeness was not at least 70% and so now I have the act the option to to react to this within SLOC and so the bot is saying how do I want to proceed so let's say I want to add my tags back in so I'm gonna say add tags I can see what tags are missing so I'll add those back in okay so I'll send that back and then this basically we have this bot that's waiting for a response from us and depending on what we say it takes action and so if we go back to portal so here we have only one tag will refresh the item detail page hopefully all the tags are there and there they are and so just like that we built a automated workflow to kind of curate items before their shirt out to the public and obviously you could do you know anything you could prevent that item is shared and it doesn't meet the requirements you could just unshare it and add the properties back okay great so we have listed some admin tips when you are working with with Web books avoid redundancy what we mean by here is that do not create multiple web books with similar events for example if you have already have a book with which is listening to a high-level event like all item changes you probably don't need another event web book which is listening to specific item changes because these two will generate duplicate messages on the security aspect make sure your receiver can communicate with your portal and has valid certificate and when troubleshooting always use the portal logs and also debug logs will give you more information and you can check the notification status link on each web book under each way book ID this will give you more information about previous previous statuses and if you needed you can deactivate of a book and activate it later and use of forward proxy like fiddler to examine the outgoing messages from the portal we have exposed number of Advanced Settings to fine-tune the web book delivery for example the number of delivery attempts and notification timeouts and the elapsed time time between delivery attempts others so with that we conclude our presentation and this since this is our first release please let us know if you want us to support my new events and many of you asks about the future service support and when it is available in online the actively working on that and hope to make make them available in incoming releases and also you can use the Geo net to give us some feedback be actively monitoring the Geo net no okay that so do give us your feedback to the Geo net we actively monitor it and we are planning to make available more book receivers in different languages like node.js and Python class so that you guys can head start on by books via at the Enterprise SDK Island so if you have questions please come come and visit us I don't think we have much time to for questions right now because next one is going to start soon and yeah don't don't forget to fill out our survey on that right thank you very much [Applause]
Info
Channel: Esri Events
Views: 2,619
Rating: 5 out of 5
Keywords: Esri, ArcGIS, GIS, Esri Events, Geographic Information System
Id: aX4VhaonTFg
Channel Id: undefined
Length: 23min 6sec (1386 seconds)
Published: Fri Apr 05 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.