What happened when we ran it
We sent
Act as a senior software architect who reviews requirements before any code is written and is willing to push back.
Task: Review the feature requirement below against our architecture constraints. Do not write any code yet.
Requirement: When someone installs our Google Sheets add-on, record their email address in our analytics database so the marketing team can send a follow-up email the same day. The record must be written before the welcome screen appears.
Architecture constraints: The add-on runs on Google Apps Script. Google limits what user details we can read, and each lookup makes several API calls. Our server only accepts authenticated requests. We have one small backend server and no queue system.
Product context: We are a two-person startup with about 300 installs a week. The welcome screen must load in under two seconds. Marketing wants to contact new users, but we have not yet confirmed that users consent to being emailed.
Steps:
1. Work out what the requirement really involves behind the scenes, including hidden network calls, database writes and permission checks.
2. Identify any part that could slow the user's first experience, break security rules or force a change to the architecture or data model.
3. Offer two or three alternatives, such as dropping part of the requirement, running it in the background, or accepting a stated compromise. Give the trade-off of each.
4. Recommend one option and list the questions I must answer before you build it.
Output:
A short heading for each step. Then a table of the options with columns for speed, security, effort and what the business gives up. Finish with a one-paragraph recommendation and a numbered list of questions for me.
The model replied
# Step 1: What the requirement really involves
"Record their email on install" looks like one write. Behind the scenes it is a chain:
1. **Trigger.** An Apps Script `onInstall(e)` trigger runs in a restricted authorization mode. It cannot always call services that need extra scopes, and it cannot make some external calls until the user has authorized the script.
2. **Getting the email.** `Session.getActiveUser().getEmail()` often returns an empty string for consumer accounts or cross-domain users unless the right scope is granted. Using `userinfo.email` means adding an OAuth scope, which changes the consent screen and may trigger Google's OAuth verification review. Each additional lookup is another API call.
3. **Authenticating to our server.** The server only accepts authenticated requests, so the add-on needs a credential. Apps Script can't safely hold a long-lived shared secret per user. Realistic options are an ID token from `ScriptApp.getIdentityToken()` (which needs `openid`/`email` scopes) or a signed request using a script-level secret. Either way the server must validate and handle failures.
4. **External HTTP call.** `UrlFetchApp` to our backend: DNS, TLS, server processing, a database write, and a response. Apps Script cold starts add to this.
5. **Database write.** Insert into analytics. Needs idempotency, because reinstalls and trigger retries will produce duplicates.
6. **Failure handling.** With no queue, if the server is down or slow, either the welcome screen is blocked, or the record is lost.
7. **Marketing follow-up.** A separate system, which has to read this table and send email on the same day.
# Step 2: Risks and problem areas
- **Speed (hard conflict).** "Write before the welcome screen appears" puts a network round trip, auth, and a DB write on the critical path of a 2-second budget. Apps Script alone can eat a large share of that. A slow or down backend breaks the first experience.
- **Reliability.** A single small server with no queue means no retry buffer. Making the write synchronous turns every backend hiccup into a failed install experience.
- **Security/permissions.** Collecting email may require new OAuth scopes, which affects the consent screen and possibly verification. Sending an email address to our server must go over authenticated channels, and the token validation needs to be built.
- **Legal/consent (the biggest issue).** You have not confirmed consent. Storing the email for analytics may be defensible. Using it for marketing email without consent can breach GDPR/ePrivacy, CAN-SPAM-type rules, and Google's API user data policy, which restricts using data from Google user scopes beyond the disclosed purpose. This can put your OAuth verification and Marketplace listing at risk. I'm not giving legal advice, but this needs resolving before build, not after.
- **Data model.** An "analytics" table holding identifiable email plus marketing purpose needs consent status, timestamp, source, and a deletion path. If the current analytics schema is anonymous, this is a schema and retention change, not a column add.
- **Requirement mismatch.** Nothing about same-day follow-up needs the write to be *before* the welcome screen. Only that it happens soon after.
# Step 3: Alternatives
**A. Synchronous write as specified.** Fetch the email and call the backend inside `onInstall`, before rendering the welcome screen.
**B. Asynchronous write, with consent on the welcome screen.** Render the welcome immediately. Include an opt-in ("Send me tips and updates") on that screen. When ticked, the client calls the backend in the background, or a time-based/one-off trigger does it with retry. Store the email with consent flag and timestamp. Failed writes retry from Apps Script's own properties store, acting as a poor man's queue.
**C. Drop email capture; use an anonymous install event.** Record an install ID and timestamp only. Collect email later through an in-product opt-in or a sign-up link for the newsletter.
# Options table
| Option | Speed | Security | Effort | What the business gives up |
|---|---|---|---|---|
| A. Synchronous, as specified | Poor: network, auth and DB write on the critical path; likely to risk the 2s target and fail whenever the backend is slow | Needs new scopes and token auth; consent gap makes it the riskiest legally | Medium | Nothing on paper, but risks install experience, verification, and compliance |
| B. Async plus opt-in consent | Good: welcome screen is unaffected | Same scopes and token auth, but with a documented lawful basis | Medium-high: opt-in UI, retry, idempotent endpoint, consent fields | Some users won't opt in, so the list is smaller; the follow-up may be minutes later, not instant |
| C. Anonymous install event only | Best: a tiny fire-and-forget call, or none | Lowest: no personal data, no extra scopes | Low | No direct email list from install; marketing relies on opt-in elsewhere, so conversion is lower |
# Step 4: Recommendation
I recommend **Option B**. Show the welcome screen immediately, with a clear opt-in for product updates. If the user opts in, send the email to the backend asynchronously with a validated identity token, an idempotent upsert keyed on the email, and a consent timestamp and source. Apps Script can retry failed sends from a stored pending flag, so no queue is needed at 300 installs a week. It keeps you inside the 2-second budget, protects you from the consent problem, keeps your OAuth review simpler, and still delivers same-day follow-up to everyone who wants it. Drop "before the welcome screen" as a requirement. It adds risk and no business value. Treat Option C as the fallback if you can't get the scope and consent questions settled quickly. Do not build Option A until consent is resolved, because it hardens a legally uncertain process into the install path.
# Questions for you
1. Do users consent to marketing email today, in your terms, privacy policy, or the OAuth consent screen? If not, can the welcome screen carry an opt-in?
2. Which jurisdictions do your users live in (EU/UK, US, other)? This determines whether opt-in is mandatory.
3. Which OAuth scopes does the add-on already request, and is `userinfo.email` among them? Are you already verified by Google, and would a new scope trigger re-verification?
4. Does Google's API user data policy allow your marketing use under your current disclosed purpose? Has anyone checked the Marketplace listing and privacy policy?
5. Is "same day" a hard requirement, or would within 24 hours (or a daily batch) be acceptable?
6. Is the "before the welcome screen" wording a real business need, or just how it was first described?
7. What authentication does your server expect today (API key, bearer token, Google ID token), and who validates it?
8. What does the analytics database store now? Is it anonymous, and can it hold personal data with deletion and retention rules?
9. What sends the follow-up email: a tool you already use, or something to build? Who owns unsubscribe handling?
10. If the backend is down at install time, is losing the record acceptable, or must it be retried until it succeeds?
11. What share of users are Workspace accounts versus consumer Gmail? This affects how reliably the email can be read.
Run on Claude Sonnet 5.5, 22 Nov 2026. Automatic check: 4 out of 5.