<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Webhook problems with Google Apps Script web apps in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809786#M13029</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm attempting to write develop a web app using Google Apps Script to handle Survey123 submission using webhooks.&amp;nbsp; I'm wondering if anyone has been able to successfully implement this yet.&amp;nbsp; My web app is not receiving the webhook posts.&amp;nbsp; It appears that everything is being blocked by a CORS issue.&amp;nbsp; In the Chrome DevTools console, I'm seeing this message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #ff0000; background-color: #fff0f0;"&gt;Access to XMLHttpRequest at '&lt;/SPAN&gt;&lt;SPAN class="" style="color: #545454; background-color: #fff0f0; text-decoration: underline;"&gt;https://script.google.com/a..../exec&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; background-color: #fff0f0;"&gt;' from origin '&lt;/SPAN&gt;&lt;SPAN class="" style="color: #545454; background-color: #fff0f0; text-decoration: underline;"&gt;https://survey123.arcgis.com&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; background-color: #fff0f0;"&gt;' 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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any possible fix or workaround for this, or is it an issue that ESRI and Google need to address between themselves?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My organization (which is fairly large) uses Google G Suite to manage email, spreadsheets, and documents.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions would be welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;webhooks&amp;nbsp; webhook‌ survey123 form‌ survey123 support‌ google&amp;nbsp;‌ #google apps script #webapp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Feb 2019 23:28:55 GMT</pubDate>
    <dc:creator>JustinJohnson2</dc:creator>
    <dc:date>2019-02-08T23:28:55Z</dc:date>
    <item>
      <title>Webhook problems with Google Apps Script web apps</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809786#M13029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm attempting to write develop a web app using Google Apps Script to handle Survey123 submission using webhooks.&amp;nbsp; I'm wondering if anyone has been able to successfully implement this yet.&amp;nbsp; My web app is not receiving the webhook posts.&amp;nbsp; It appears that everything is being blocked by a CORS issue.&amp;nbsp; In the Chrome DevTools console, I'm seeing this message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #ff0000; background-color: #fff0f0;"&gt;Access to XMLHttpRequest at '&lt;/SPAN&gt;&lt;SPAN class="" style="color: #545454; background-color: #fff0f0; text-decoration: underline;"&gt;https://script.google.com/a..../exec&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; background-color: #fff0f0;"&gt;' from origin '&lt;/SPAN&gt;&lt;SPAN class="" style="color: #545454; background-color: #fff0f0; text-decoration: underline;"&gt;https://survey123.arcgis.com&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; background-color: #fff0f0;"&gt;' 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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any possible fix or workaround for this, or is it an issue that ESRI and Google need to address between themselves?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My organization (which is fairly large) uses Google G Suite to manage email, spreadsheets, and documents.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions would be welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;webhooks&amp;nbsp; webhook‌ survey123 form‌ survey123 support‌ google&amp;nbsp;‌ #google apps script #webapp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2019 23:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809786#M13029</guid>
      <dc:creator>JustinJohnson2</dc:creator>
      <dc:date>2019-02-08T23:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Webhook problems with Google Apps Script web apps</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809787#M13030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/19125"&gt;Justin Johnson&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which webhook provider are you using (Ex. Integromat, Microsoft Flow) and&amp;nbsp;could you provide a little more information about how you are configuring the webhook? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Morgan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2019 00:06:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809787#M13030</guid>
      <dc:creator>MorganWaterman</dc:creator>
      <dc:date>2019-02-22T00:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Webhook problems with Google Apps Script web apps</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809788#M13031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Morgan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm hoping to handle the webhook using a Google Apps Script published as a web app.&amp;nbsp; It's basically a script that, when published, can respond to HTTP POST requests.&amp;nbsp; There is a brief description of the process here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://developers.google.com/apps-script/guides/web" title="https://developers.google.com/apps-script/guides/web"&gt;https://developers.google.com/apps-script/guides/web&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; As of now, the development URL for that script is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://script.google.com/a/utah.gov/macros/s/AKfycbwnT3nm474APPWufmyt2H1R960IeHDTSRcLFloQ8i4/dev" title="https://script.google.com/a/utah.gov/macros/s/AKfycbwnT3nm474APPWufmyt2H1R960IeHDTSRcLFloQ8i4/dev"&gt;https://script.google.com/a/utah.gov/macros/s/AKfycbwnT3nm474APPWufmyt2H1R960IeHDTSRcLFloQ8i4/dev&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure how to work around that CORS policy message, yet.&amp;nbsp; I'm not very experienced with the sort of web server configuration.&amp;nbsp; 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.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2019 17:45:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809788#M13031</guid>
      <dc:creator>FFSL_-_JustinJohnson</dc:creator>
      <dc:date>2019-02-22T17:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Webhook problems with Google Apps Script web apps</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809789#M13032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Justin, you will need to enable CORS in your script. I would start by looking in &lt;A href="https://stackoverflow.com/search?q=%5Bgoogle-apps-script%5D+CORS"&gt;Stack Overflow [google-apps-script]&lt;/A&gt; as &lt;A href="https://developers.google.com/apps-script/support"&gt;recommended by Google&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After a &lt;A href="https://stackoverflow.com/questions/53433938/how-do-i-allow-a-cors-requests-in-my-google-script"&gt;quick search&lt;/A&gt;, this could be a potential solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should specify &lt;CODE&gt;Access-Control-Allow-Origin&lt;/CODE&gt; on &lt;A href="https://cloud.google.com/storage/docs/cross-origin#server-side-support" rel="nofollow noreferrer"&gt;Google Cloud side&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;You can use either of the following XML API request URLs to obtain a response from Cloud Storage that contains the CORS headers:&lt;/P&gt;&lt;P&gt;storage.googleapis.com/[BUCKET_NAME]&lt;/P&gt;&lt;P&gt;[BUCKET_NAME].storage.googleapis.com&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2019 08:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/webhook-problems-with-google-apps-script-web-apps/m-p/809789#M13032</guid>
      <dc:creator>IsmaelChivite</dc:creator>
      <dc:date>2019-02-23T08:21:08Z</dc:date>
    </item>
  </channel>
</rss>

