# Legacy Wealth Advice CRM — Google Workspace add-on This package contains a native Gmail sidebar add-on implemented with Apps Script and CardService. It connects to the same private LWA CRM records as the hosted app and Chrome extension. The existing Gmail test deployment's private CRM server connection is configured. Individual staff connections, end-to-end Gmail validation and private Marketplace publication remain pending. The add-on can find and create clients, show their advice stage and activity, set tasks, add notes and call logs, save the currently opened email, and file selected original attachments. It also offers Case discussion and permitted pipeline choices on client creation and advice edits. Client cards now link directly to the client's Studio file and OnlyPlans Desk. Imported Studio demos are excluded from automatic email matching but remain available through explicit client search. Gmail renders these as sidebar cards. This add-on does not replace Gmail's main page, recreate Streak's full-width interface, or provide background inbox scanning. The Chrome extension remains the separate full-width experience. ## What is ready and what still needs an administrator The package includes `Code.gs`, `DonmontTaskAlerts.gs`, `appsscript.json`, a branding asset and a draft Marketplace description. Both `.gs` files must be present in the same Apps Script project. The CRM provides the matching API and owner-only connection setup at: https://evergreen-advice-workspace.sonay-siper.chatgpt.site/workspace-addon The private Sites service credential was configured in the verified Apps Script project's Script Properties. The existing Gmail test deployment is preserved, and the CRM retains an active sidebar authorization for `sonay@donmont.com.au`. This package update has not been deployed to Google Apps Script. Replace `Code.gs` in that same project and refresh or update its deployment to add the Studio shortcuts; retain its Script Properties and existing user connection. New staff members need their own connection key entered in Gmail → LWA sidebar → Connect workspace. End-to-end validation of this update in Gmail and private Marketplace publication remain pending; no Marketplace listing has been published. Current public setup identifiers: - Google Cloud project ID: `donmont-capital-crm-512309` - Google Cloud project number: `400587329737` - Apps Script Script ID: `1cDdkE4UqBuRvqMTRf53VymE-qzK4J3JEIvKjGI_eqf-mXp7iZyQJnnN7` - Apps Script OAuth client ID / Google audience, verified from the live Gmail setup card: `400587329737-f7ts8496h8cmt03pul5g4dgpg6nhsss0.apps.googleusercontent.com` - Gmail test deployment ID: `AKfycbxtere4MTzWDzKLEa5Nt4MpZWg24Ltp3h5J9_vCKAc` The CRM connection form prefills this audience. Each staff member must still use the Google email shown in their own add-on setup card. ## Phase 1 — create and test the Google deployment 1. Sign in to Apps Script as the LWA administrator and open the existing LWA project. For a fresh installation, create a project and copy both `Code.gs` and `DonmontTaskAlerts.gs` into separate Script files. When updating an existing installation, replace the matching source files and add `DonmontTaskAlerts.gs` if it is missing. In Project Settings enable showing the `appsscript.json` manifest, and replace its contents with this package's manifest. 2. Associate the Apps Script project with the administrator-controlled **standard Google Cloud project** `donmont-capital-crm-512309`, using project number `400587329737` where Apps Script asks for a project number. The owner has completed this link for the current test deployment. 3. Review the project's OAuth consent configuration and the exact scopes in the supplied manifest. Configure the appropriate organisation audience. For testing, permit the Google account that will run the add-on. Its identity scopes are `openid` and `userinfo.email`; the Gmail scope is current-message read access, not whole-mailbox `gmail.modify`. 4. Completed for the current test deployment: the supported private Sites service credential is configured as `DONMONT_SITE_SERVICE_TOKEN` in the verified Apps Script project's **Script Properties**. A new Apps Script project requires authorised administrator provisioning through approved secure tooling; deployment versions in the same project share its Script Properties. It must be the supported service credential for this exact private Site, not a Google OAuth client ID or secret. Do not put its value in source files, the ZIP, a card, a listing, or this chat. Keep the Site private. 5. In Apps Script choose **Deploy → Test deployments**, select the Google Workspace add-on deployment, and install it for a test account. Authorise it, refresh Gmail, and open its LWA icon in Gmail's right sidebar. Google may adjust these labels in its interface; follow the test-deployment flow for a Workspace add-on. 6. In the add-on's connection card choose **Show Google setup information**. Copy the displayed **Apps Script OAuth client ID / Google audience** and Google account email. This audience comes from this Apps Script project's Google identity token. The Web application client used by the Chrome extension is not a substitute. If identity is unavailable despite both identity scopes appearing in the manifest, save the script and run `authoriseDonmontGoogle` from the Apps Script editor. Review and grant the requested permissions with the work account, then run it again. Its log reports only successful authorisation. Return to Gmail and refresh the add-on; never log or share the identity token. 7. As the signed-in CRM owner, open the connection setup URL above. Enter that exact staff Google email, the Apps Script OAuth client ID, and an optional connection label. Choose **Create connection key** and deliver the one-time displayed key to that member through an approved private channel. 8. In Gmail, that staff member enters the key in **Connect workspace**. The key is stored in that user's Apps Script User Properties as `DONMONT_CONNECTION_KEY`; it must not be shared in the project-wide Script Properties. Each member needs their own connection. 9. Test with an authorised client: client search and creation, a task, a note, a call log, current-email capture, an original attachment, and an advice-stage update. Verify these appear in the same private CRM. Revoke the test key in CRM setup and verify add-on access is denied. Record the actual Script ID, deployment ID, OAuth audience and test evidence in the deployment checklist. Only the account holder can complete Google sign-in and consent. Do not paste Google tokens, client secrets, service credentials or connection keys into support messages. ## Phase 2 — private LWA staff Marketplace listing 1. Confirm that the standard Google Cloud project belongs to the intended LWA Google Workspace organisation and that its administrator permits private Marketplace applications. A personal Gmail account or a project under "No organisation" does not establish an organisation-wide private publishing boundary. An administrator may need to choose or move to an appropriately managed project. 2. Prepare a versioned Apps Script add-on deployment and record its real deployment information. Enable/configure the **Google Workspace Marketplace SDK** in the same standard Cloud project. 3. In the SDK's app configuration select the Google Workspace/Gmail add-on integration, supply the actual Apps Script deployment information, and match the OAuth scopes to `appsscript.json`. Review installation settings and choose the private visibility appropriate to the LWA organisation. Private visibility does not make the CRM web app public or give members permission to open it in a browser. 4. Complete the store listing using `marketplace-listing.md` as a draft. Supply actual support, privacy and terms URLs; review the existing company policies for this add-on's processing before publishing. Upload icons and screenshots that satisfy the dimensions shown by the current SDK. The included original company emblem is not represented as a complete, correctly sized Marketplace asset set. 5. Complete Google's required configuration, administrator checks and any applicable OAuth or Marketplace review. Publish privately, then use the resulting actual Marketplace URL for staff installation or administrator deployment. No listing URL exists until Google creates it. Users need the private Marketplace installation **and** a matching owner-issued connection key. A connection key authorises the add-on API for its paired Google identity; it does not grant separate access to the hosted CRM pages or downloaded files. Those browser links retain the existing private Sites sign-in/access policy. ## Staff access and task alerts - The workspace owner manages **Settings → Gmail add-on staff access** at `/settings`. Choose all or selected clients, read-only or edit access, and whether a staff account can file new Gmail messages and their attachments. Permissions follow the verified Google email across all of that account's connection keys. Existing accounts retain their previous client restrictions within the default Legacy Wealth Advice pipeline. New pipelines start private to the owner. Pipeline access and client restrictions must both permit a client; an empty selected list grants no access. Manage pipeline grants, comment permission and shared correspondence visibility at `/pipelines`. Choosing all pipelines explicitly includes future pipelines. - **Block new filing of common security emails** checks common security-related subject patterns. It is a safeguard, not a guarantee of sensitive-content detection. It hides matching security-subject messages from that staff account and blocks new filing; it does not delete stored records. These staff controls apply to the native Gmail add-on; the separately authenticated owner's browser and Chrome companion retain owner access. - In Gmail, open **Tasks & alerts** for assignment, due/overdue and completion alerts, personal alert preferences and mark-as-read controls. The card refreshes when opened or refreshed. Enter the assignee's connected Google email on a task to direct staff alerts; display names alone are not matched to accounts. Client access is checked again when alerts are loaded. - The CRM's bell and `/settings` show workspace task alerts. Browser notifications require explicit permission and remain off until enabled. They work while the CRM is open. This release does not send notification emails or deliver alerts after the CRM is closed. ## Updating an existing Gmail installation Download the latest package from `/workspace-addon`, replace `Code.gs` in the existing Apps Script project, update `DonmontTaskAlerts.gs` and `appsscript.json` from the same package, and save. Refresh Gmail for a HEAD test deployment. For a versioned staff deployment, create a new Apps Script version and update the existing deployment to that version. Preserve the project, deployment and connection properties; no new connection key or OAuth audience is needed for this code update. The **Case discussion** button appears on a client card after the updated code is deployed. Comments use the verified staff Google account, remain in the CRM and do not send emails. Read-only staff can comment only when permitted. Cases and discussion history follow the client's current pipeline; access is checked again when loading or posting. ## Security and data scope - Gmail grants temporary access to the current opened message. Its access token stays inside Apps Script and is never sent to the CRM or carried in action parameters. Message actions fail closed without a fresh matching Gmail event. - The backend verifies the Google identity token's signature, issuer, expiry, audience and verified email, together with the revocable member connection key. The Apps Script service credential is only the private platform transport gate; it does not replace member authorisation. - Selected files must satisfy the CRM's file limits. Changes use the same workspace and revision-controlled persistence as the existing app. - Background bulk Gmail import, automatic Gmail labelling, full Streak parity, Drive/Calendar integration and SOA Studio integration are outside this native add-on package. ## Official references - Add-on manifest: https://developers.google.com/apps-script/manifest/addons - Gmail add-on scopes: https://developers.google.com/workspace/add-ons/concepts/gmail-scopes - Test deployments: https://developers.google.com/workspace/add-ons/how-tos/testing-workspace-addons - Publishing overview: https://developers.google.com/workspace/add-ons/how-tos/publish-add-on-overview - Marketplace publication and visibility: https://developers.google.com/workspace/marketplace/how-to-publish - Apps Script standard Cloud projects: https://developers.google.com/apps-script/guides/cloud-platform-projects - Marketplace listing assets: https://developers.google.com/workspace/marketplace/create-listing Google's live console and policies control publication requirements; these links are references, not a claim that this deployment has been approved. ### Gmail recipient matching update The current Code.gs checks all To/Cc addresses together (up to 100), rather than choosing a client from the first few recipients. Multiple matching clients remain an explicit choice. Larger recipient lists require Find client. For the matching change, update Code.gs in the existing Apps Script project, retaining connection properties and the current Google Cloud project. Refresh a HEAD test installation, or update the existing versioned deployment after saving. This package does not deploy Apps Script automatically.