I'm attempting to write develop a web app using Google Apps Script to handle Survey123 submission using webhooks. I'm wondering if anyone has been able to successfully implement this yet. My web app is not receiving the webhook posts. It appears that everything is being blocked by a CORS issue. In the Chrome DevTools console, I'm seeing this message:
Access to XMLHttpRequest at 'https://script.google.com/a..../exec' from origin 'https://survey123.arcgis.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Is there any possible fix or workaround for this, or is it an issue that ESRI and Google need to address between themselves?
My organization (which is fairly large) uses Google G Suite to manage email, spreadsheets, and documents. I want to deploy a Google Apps Script, as a web app, to handle the POST from the Survey123 webhook. Then, have the script email various people in my organization to let them know that a new survey form submission has been posted.
Any suggestions would be welcome.
webhooks webhook survey123 form survey123 support google #google apps script #webapp
I'm hoping to handle the webhook using a Google Apps Script published as a web app. It's basically a script that, when published, can respond to HTTP POST requests. There is a brief description of the process here:
We use Google G Suite internally, for all of our email and calendar coordination. I would like to have the Survey 123 webhook send a POST request with the event data to the Payload URL, which is the URL of the published web app on our application's G Suite. As of now, the development URL for that script is:
The script at that URL should be able to handle a POST request from the webhook when a new record is posted in Survey123, extract the encoded data in the payload, then send email messages to a list of people in our organization with information from that new record.
I'm not sure how to work around that CORS policy message, yet. I'm not very experienced with the sort of web server configuration. Ideally, I would like Survey123 to send the message to our published Google Web App directly, without going through a 3rd party handler such as Integromat or Microsoft Flow.
After a quick search, this could be a potential solution:
You should specify
Access-Control-Allow-Origin on Google Cloud side:
Cloud Storage allows you to set CORS configuration at the bucket level only. You can set the CORS configuration for a bucket using the gsutil command-line tool, the XML API, or the JSON API. For more information about setting CORS configuration on a bucket, see Configuring Cross-Origin Resource Sharing (CORS). For more information about CORS configuration elements, see Set Bucket CORS.
You can use either of the following XML API request URLs to obtain a response from Cloud Storage that contains the CORS headers: