Hi @hayttom_ocha, here’s a proposed workaround for this without making changes to the KoBo codebase to allow for external API requests.
- Create a simple form with a
geopointquestion and extrahiddenquestion:
| type | name | label |
|---|---|---|
| geopoint | location | Where are you? |
| hidden | p_code |
- Create a Cloudflare Worker that consumes
POSTdata - Copy the Worker URL and use it to set up a REST Service in KoBo
-
Extend the Worker to parse the submission JSON for
locationcoordinates and use the ITOS P-Code API to get the code -
Extend the Worker again to make a
PATCHrequest to/api/v2/assets/<asset_uid>/data/bulk/to update thep_codequestion value with the code returned from the API
This may however be more suitable to an AWS Lambda Function, following the same general workflow. We are currently using Lambda and API Gateway with SES to send messages to Zulip when submissions come in to a deployed form.
(Disclaimer: I haven’t had the opportunity to fully test this, but in theory it should work)
