Add support for Survey123 webhooks
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
It is possible to configure one or more webhooks on a survey123 form and we are starting to see solutions that would leverage them, for example to send a payload to Workflow Manager when a survey is submitted. In looking at the survey api for this it would seem we would need to do the following:
On Creation:
1. Query the endpoint https://www.arcgis.com/sharing/rest/content/items/e18da2375a18455aa4d2c1d8975c0b1a/info/form.json, where the item id is the id of the survey123 form.
2. This returns a response that under settings.notificationInfo can have a webhooks property which can contain an array of webhook objects. If the property exists we should store the webhooks array in the template properties object for the form.
3. We also need to templatize any item id references or portal urls in the webhook definition. For example there may be an item id of an ArcGIS Workflow in the url property of the webhook
On Deployment:
1. Create the survey form as usual
2. After the survey is created there is an api to add a webhook: https://survey123.arcgis.com/api/survey/e18da2375a18455aa4d2c1d8975c0b1a/webhook/add where the item id is the id of the new survey123 form.
3. Then in the payload you can provide the definition of the same detemplatized definition of the webhook stored with the template.
f: json
webhook: {"active":true,"name":"Test","url":"https://www.esri.com","includePortalInfo":true,"includeServiceRequest":true,"includeUserInfo":true,"includeServiceResponse":false,"includeSurveyInfo":false,"events":["addData"]}
portalUrl: https://www.arcgis.com
Below is an example of a survey123 form with a webhook configured for testing:
https://localdeployment.maps.arcgis.com/home/item.html?id=df5239803ee144a09a1f3983d3747f18
Contributor guide
Assessment
This issue has not been assessed yet.