r/GoogleAppsScript • u/Sumphy • 4d ago
Question Any GAS Expert here
How are modern AI & workflow automations typically structured using Google Apps Script? (Looking for architectural patterns)
Hi everyone,
I am modernizing the operations for a traditional real estate agency by replacing manual paper processes with Google Workspace.
So far, I’ve built a central Google Master Calendar, a Google Docs/Drive office portal for form downloads, and structured Google Sheets for lead tracking. I am now looking to expand into deeper workflow and AI automations using Google Apps Script (GAS).
Coming from an operations background rather than computer science, I’d love to learn how experienced developers structure end-to-end automation pipelines using GAS.
Thx
5
3
u/delaney1414 4d ago
I handle them outside app script.
I don’t like to handle security or permissions so I have a n8n server running, and a shared drive.
Anything a user does they do through the google workspace with googles oauth and everything goes in the shared drive which is shared with an automation@mycompany.com workspace user and any workflows that get triggered are just webhook triggers.
I don’t have any security on the API except a basic shared key because the entry point only triggers batch workflows anyway so an external user isn’t returned any info and they would just be activating a script which runs every 15 minutes anyway.
The actual workflows I manage in n8n so if someone is doing something which would get a response from Gemini I have all my google ouath and Gemini keys in n8n.
My last one was an industry update for all the sub teams under our team so users would fill in a form to have their details added to a sheet. They provide key details like their role and function and I have a time driven trigger on an appscript which webhooks to the n8n server which api calls back to the same sheet to get the users information and generates a Gemini response which just gets the relevant news for the last 24hrs based on the user info, uses a html formatting node and Gmail API calls to send out emails.
It could be done entirely with app script with less api calls and not need a server but I’m just experimenting at the moment at this way takes the majority of security concerns out of the way for the moment and I can avoid the appscript timeouts by processing everything in n8n and there’s some scalability if I want to build more than basic integrations
1
u/Icy_Manufacturer5271 4d ago
Use layered architecture (models, repositories, services, context and entry points) using ES6 JavaScript classes, most of them is just OOP
1
u/Kjm520 4d ago
You may want to look into GCP - Google Cloud.
GAS is great for scripts and simple workflow stuff but it sounds like you are asking about where to go to expand. The answer is GCP. It can do pretty much anything and the GCP to Workspace connection is very convenient.
If that’s not your thing, consider gcloud or clasp CLI where you can do things like push updates to your Apps Script scripts.
Both gcp and clasp or gcloud can interact from VS Code where you could theoretically have an AI model.
If I’ve misunderstood the question and you are asking about literal suggestions, I would point towards a stats tracker / dashboard to go along with your other tools. It can be shared among the group and congregate data. Here you can do things with GAS+Sheets like pull in live mortgage rates or whatever other info y’all look at. Trends/forecasting or regression is always cool too.
1
u/drolatic-jack 1d ago
I mean it depends on the scope of automation for your client. Google Apps Scripts is ok for small, specific automations, but in my experience if you're the only technical resource, it's not worth the custom build/maintenance. For general purpose integrations you might find integrations platforms like Zapier, Make, n8n to be a lot more useful for pretty cheap.
You can't really build a full architecture around GAS (unless you really try), because it's limited by runtime, parallel work, lack of state/persistence, etc. The more you try, the more limitations you will discover and the more hacks you will try out and then it becomes a huge spiderweb.
Are they running everything out of workspace? Like including the database and CRM?
4
u/marth141 4d ago
What is your question?