Survey 123 Webhook to Moderate Content?

412
21
04-02-2019 12:14 PM
Highlighted
Occasional Contributor

Is there any way to use MS Flow to start an approval process that pushes a public facing survey response to a private feature service until the content has been approved? Trying to figure out how to screen crowd source images and text before posting to the public facing service. Possible? Thanks, cob

Tags (2)
Reply
0 Kudos
21 Replies
Highlighted
Esri Esteemed Contributor

Hi,

Yes, it is quite possible to set this up.  The specifics would depend on the exact workflow you wish to implement, but here is a sample idea:

- The feature class includes a 'review_status' field, that is either null (blank), 'In review', 'Approved', 'Not Approved'

- The form does not include a review_status question, meaning it will be blank when submitted

- You could have a Webhook attached to the form that e-mails the designated reviewer, notifying them of the new submission.  I would suggest either including the content to be reviewed in the e-mail or providing a link for the person to review

- If you can include the entire content, you could include a link that triggers a second webhook with the id and have it update the feature to approve.

- Otherwise, you would have an editing app available that could let the review approve or not approve the submission

Reply
0 Kudos
Highlighted
Occasional Contributor

Thanks James -  I haven't used Flow much, just to send notification emails, but we are trying to use the Flow approval process when a new survey response is submitted. Will Flow hold the survey response in limbo until it is approved or will it be posted before the workflow is initiated? Why do I need to add fields to the feature class when using the Flow process? I am basically stuck at what to do if Response (for the approval in Flow) is 'Reject' where I would just want to delete the record from the survey without posting. The only option for the S123 connector at that point is 'Get Surveys' and I can't see a way to reference anything from the target survey I set initially. Also, my understanding is that the dynamic content links for the S123 webhook do not recognize image attachments which is obviously one of our main concerns in this situation. But really if Flow will just hold the response and notify the reviewer that would meet our needs well enough.

Can you elaborate a bit on how to set the second webhook using the survey content? Or is there a better way given the information above? Thanks, cob

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Charles,

Flow doesn't hold the response in limbo - that was why I suggested adding a field to the feature class, to store the status of the feature in the feature's table - this makes it pretty easy to filter those records not approved for other maps and applications.

With regard to images, you are correct - it would probably be more appropriate for the reviewer to use another application to present the full submission if that is part of the review.  In terms of deleting records if rejected, that can be done either in an application that is being used to review, or could be automated via geoprocessing script or webhook - the latter would need some familiarity of the ArcGIS REST API).

Highlighted
Occasional Contributor

Got the first part, apologies for my denseness. But you've intrigued me with the second webhook - would that be done in Flow as well? Can you give a brief example of how it would work? Thanks, cob

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Charles, 

Actually, I've found that this is built into MS Flow - see Create a flow to manage project approvals - PowerApps | Microsoft Docs and Approvals - Connectors | Microsoft Docs .  The first link is a little out of date, but should get you started.  See the image below for a sample I made in exploring this; the 'If no > Send an email' would change to an HTTP action to the feature layer's applyEdits URL that would update the field.

Reply
0 Kudos
Highlighted
Occasional Contributor

Ahh, I thought it might work that way - but which action do I use from Flow when entering the Http action? I assume you are referring back to the REST API? Can you show an example of what that would look like, say to change an approval field from No to Yes? Thanks for all your help, James. 

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Charles,

I plan to work on a fuller document presenting this as a workflow, but the call would most likely be an applyEdits call at either the Feature Service or Feature Layer resource.  Exactly which call would depend on how your data processing work, but the 2 most likely:

- an update to the feature to change the status field to an approved state when approved

- a delete to remove the feature when rejected

Reply
0 Kudos
Highlighted
Occasional Contributor

Thanks James. Please keep me posted on your progress - I will be monitoring

this thread in case you have news. For now we are sending emails and

editing the hidden field as you suggested. The response also triggers an

email to the (public) submitting individual advising of the status. Thanks

again James - cob

Reply
0 Kudos
Highlighted
Occasional Contributor

Well I couldn't leave this alone James... have an https request connecting to the feature service through Flow (I think) but it doesn't do anything. The request works fine in the API in AGOL (having to hard code the objectid of course - I tried that in the Flow to no avail). In Flow it breezes right through with status 200 but fails to update the field. What am I missing here? Anything need to go in the header or am I totally off base? Thanks, cob

Reply
0 Kudos