Connection to Google AppScript

I have a Google App Script web app or executive api (any of the two can be utilized) that picks the data from the “event” trigger and updates a Google Docs Template with the given data.

I wish to store the data in google Firebase (this successfully works), also to get the data in Appgyver by selection with a dropdown list.
Until this step everything works fine. Here comes the problem.

I have my AppScript url, in which I have a doGet(e) function. But I cannot pass data from Appgyver to the AppScript. Should I use the “HTTP request” flow function and if yes, how to set that up, because I did not manage to solve it. Or am I better of by creating a new “data resource”? And if so, how to complete that?

Thanks in advance

======== UPDATE ========
At some point in the past Google changed cross-origin policy with the app scripts. So now it throws CORS error when directly accessing a specific appscript. In case someone uses google cloud services and creates a storage bucket for their script and has organisation set up with google cloud, they could configure their own CORS policy in their settings. Since I have none of the above and yet do not plan to register a storage bucket, I have come up with a pretty ugly workaround… Here it goes:

Google Forms do receive their answers through POST method.
So to pass my data from the Appgyver app:

  1. I have created a Google Form with only one question (short answer).
  2. Get the url of the form and change the last word (“viewForm”) to “formResponse?”
  3. You have to open the form and also use browsers inspector. Within the elements tab use search and type “entry” that will give you the identifier of the only question. That is the name which google uses to post the answer to the answers sheet.
  4. Modify further the form url. Add to the end your “entry.132456789=”, so now the end of the url should be something like: formResponse?entry.123456789="
  5. in the Appgyver app I have a button component on which “Tap component” event triggers a HTTP request function flow
  6. in this request’s inputs at the “URL” I paste my modified form url + the data I want to pass on with json encoding:
"yourModifiedFormUrl"+ENCODE_JSON(data.yourDataVariableName)
  1. Set the other inputs of the flow function:
  • method: POST
  • Headers: header: Content-Type, value: text/plain
  • Request body: empty string (Formula: “”)
  • Request body type: JSON
  1. After button tap you will get CORS error in the network logs, but your data will arrive to your form’s response google sheet. From then on You can use that in your scripts.

If You pass on data as object with properties then You will need to parse that in the google script to be able to use it as an object. The following code is placed in the spreadsheet with answers.

function doGet(e) {
var parseData = Utilities.jsonParse(e.values[1]);
  return yourOtherFunctionInTheScript(parseData); 
}

I honestly hope to find a more “best practice” type of solution, such as httprequest proxy or ending up creating a storage bucket and configuring my own CORS policy. But in development phase this solution seems to be enough for me.
Also maybe the final solution will be to host my Appgyver built app on the same domain as the google scripts as web app as well. So there would be no cross-origin.

Anyways, have a nice day.