Google Chat for VS Code
Browse your Google Chat spaces and direct messages, read history, send and edit messages,
react, and reply in threads — without leaving VS Code. The extension acts as you (your
own Google OAuth credentials), receives incoming messages in real time, and can draft replies
in your own writing style using VS Code's built-in AI.
One-time setup required. Google Chat has no drop-in API key, so you bring your own
Google Cloud OAuth client — a ~10-minute, one-time setup described below. Your credentials
and tokens stay on your machine in VS Code SecretStorage; nothing is sent to a third party.
Features
- Browse your spaces, group chats, and direct messages, with sender names and avatars resolved from your Workspace directory
- Unread conversations are bolded and auto-marked read as you leave them
- Read message history with infinite scroll (older messages load as you scroll up)
- @mention highlighting, clickable links, and quoted-message previews
- Send messages (Enter to send, Shift+Enter for a newline) and reply in threads
- Quote a message in your reply
- Edit and delete your own messages
- React with emoji — a quick-react row of your most-used emoji, plus a full picker
- Copy any message's text
- AI assist (powered by VS Code's language model): explain a message, gauge its sentiment, or draft a reply in your own writing style
- Real-time incoming messages via Google Workspace Events + Pub/Sub, or a polling fallback
Requirements
- A Google Chat account in Google Workspace. The extension resolves sender names and
avatars from your organization's directory (via the People API), so personal
@gmail.com
accounts are not supported.
- VS Code 1.90 or newer.
- A Google Cloud project in which you can create an OAuth client — you bring your own
credentials (see Setup). There is nothing to buy.
- Optional, for AI assist: a VS Code language-model provider such as GitHub Copilot
Chat. Without one, the AI actions report that no model is available.
Getting started
- Install the extension from the VS Code Marketplace — search "Google Chat for VS
Code", or run
ext install LeonardoCastro.vscode-google-chat from Quick Open (Ctrl/Cmd+P).
- Complete the one-time Google Cloud setup to get an OAuth
Client ID and client secret.
- Open the Google Chat view from the activity bar, or run Google Chat: Open from the
Command Palette.
- Click Settings (the gear icon, or Google Chat: Configure), enter your Client ID and
secret — plus the optional Pub/Sub fields — then Save & Sign in. (Or click Sign in
with Google directly; you'll be prompted for the client ID and secret if you haven't saved
them yet.)
- A browser window opens for Google sign-in; approve the requested scopes. Your spaces and DMs
then populate — unread ones are bold. Pick one to load history; scroll up for older messages.
Day to day: type in the composer and press Enter to send (Shift+Enter for a newline).
Hover a message for its toolbar — react, reply in thread, quote, or (on your own messages) edit
and delete. The ⋯ menu adds copy and the AI actions.
Setup — Google Cloud (one-time)
The data features (read/send/reply) require only steps 1–3 and work with polling real-time
mode, which needs no extra infrastructure. Real-time push (events mode) additionally
requires the optional Pub/Sub setup.
1. Create / pick a project and enable APIs
In the Google Cloud Console:
- Create or select a project.
- Enable these APIs (APIs & Services → Enable APIs):
- Google Chat API
- People API (resolves sender display names + profile photos)
- Google Workspace Events API and Cloud Pub/Sub API — only if you want
events
mode (see Optional).
- APIs & Services → OAuth consent screen.
- If you are in a Google Workspace organization, choose Internal (simplest — no
verification needed). Otherwise choose External and add your own account as a
Test user while in "Testing" mode.
- Add the scopes the extension uses:
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.users.readstate (unread tracking + mark-as-read)
https://www.googleapis.com/auth/directory.readonly (sender names + photos via the People API)
https://www.googleapis.com/auth/pubsub (only for events mode)
openid, email, profile
Note: chat.messages is a Google "restricted" scope. In Testing mode or for
Internal apps this is fine. Publishing publicly would require OAuth verification and a
security assessment.
Heads-up: An OAuth app left in "Testing" publishing status issues refresh tokens
that expire after 7 days, so you'll be asked to sign in again about once a week.
Workspace users should pick Internal; everyone else can move the app to "In
production" (no verification needed for your own use) to get long-lived sessions.
3. Create an OAuth client ID (Desktop app)
- APIs & Services → Credentials → Create Credentials → OAuth client ID.
- Application type: Desktop app.
- Copy the Client ID and Client secret. The extension will prompt you for both
on first sign-in (the secret is stored in SecretStorage; the client ID is saved to the
googleChat.oauthClientId setting).
Desktop-app clients use a loopback redirect (http://127.0.0.1:<port>/oauth2callback),
which the extension starts automatically during sign-in.
Optional: real-time push (events mode)
polling mode (the default) re-checks the open conversation every few seconds and needs no
extra setup. For instant push of messages sent from other clients (~1–2s), switch
googleChat.realtimeMode to events and set up Pub/Sub. If any of the three events settings
is missing, the extension automatically falls back to polling.
First enable the Google Workspace Events API and Cloud Pub/Sub API (step 1 above), then:
Create a Pub/Sub topic + subscription
- Pub/Sub → Topics → Create topic (e.g.
chat-events). Note its full name:
projects/PROJECT_ID/topics/chat-events.
- On that topic, create a pull subscription (e.g.
chat-events-sub).
Grant the Workspace Events service agent publish rights
Google Workspace Events publishes to your topic via a Google-managed service account.
Grant it the Publisher role on the topic:
- Service account:
service-PROJECT_NUMBER@gcp-sa-chat.iam.gserviceaccount.com
(find PROJECT_NUMBER on the project's dashboard).
- On the topic → Permissions → Add principal → role Pub/Sub Publisher.
Your own account (project owner/editor) already has subscribe rights to pull from the
subscription. The extension creates a Workspace Events subscription for all your spaces and
consumes it via a Pub/Sub streaming pull; the subscription is renewed automatically while the
panel is open.
Extension settings
Enter these through the in-app Settings form (gear icon in the Google Chat view, or the
Google Chat: Configure command) — or edit them directly in VS Code settings:
| Setting |
Required |
Description |
googleChat.oauthClientId |
Yes |
OAuth 2.0 Client ID ("Desktop app" type). Set automatically on first sign-in if blank. |
googleChat.realtimeMode |
— |
events, polling (default), or off. |
googleChat.pollingIntervalSeconds |
— |
Poll cadence for polling mode (default 5, min 2). |
googleChat.gcpProjectId |
events only |
Project ID hosting your Pub/Sub topic/subscription. |
googleChat.workspaceEvents.pubsubTopic |
events only |
Full topic name projects/PROJECT/topics/TOPIC. |
googleChat.pubsubSubscription |
events only |
Pull subscription ID on that topic. |
The OAuth client secret and tokens are not settings — they live in SecretStorage.
AI assist
The AI actions run on VS Code's built-in language model, so they need an active model
provider such as GitHub Copilot Chat. With none available, each action reports that no
model was found. From a message's ⋯ (More) menu:
- Explain — restates the message in plainer, clearer terms.
- Sentiment — labels it Positive / Negative / Neutral / Mixed, with a one-line reason.
- Draft reply — writes a reply in your voice. It samples your own recent messages in
the space (for style) and the recent conversation (for context), then drops the draft into
the composer to review and edit before sending. Nothing is ever sent automatically. You
can also trigger this from the composer to reply to the latest messages.
Only the text needed for a given action is sent to VS Code's language model — never to Google.
Commands
- Google Chat: Open — open the main chat panel.
- Google Chat: Configure — open the in-app Settings form.
- Google Chat: Sign In / Sign Out.
Privacy & how it works
All Chat requests are made with your Google credentials. Tokens and the OAuth client
secret are stored in VS Code SecretStorage — never in settings or on disk in plain text.
AI features run through VS Code's built-in language model, so message text used for them is
not sent to Google.
Extension Host (Node) Webview (React)
OAuth2Client (google-auth-library) 3-pane UI:
├─ ChatClient → chat.googleapis.com [Spaces] [Messages + composer] [Thread]
├─ People API → people.googleapis.com (names + avatars)
├─ EventsSub → workspaceevents (subscribe)
├─ Pub/Sub streaming pull → live events
└─ vscode.lm (Copilot) → explain / sentiment / draft reply
Known limitations
- Real-time push (
events mode) needs non-trivial Pub/Sub setup. The default polling
mode needs only the OAuth setup (steps 1–3).
chat.messages is a restricted scope — fine for Testing-mode / Internal use; public
distribution would need OAuth verification.
- AI assist needs a VS Code language-model provider (e.g. GitHub Copilot Chat); without
one, Explain / Sentiment / Draft reply report that no model is available.
- Messages are sent as plain text. Incoming @mentions, links, and quoted replies render, but
attachments/uploads, cards, custom (image) emoji, search, and presence are not yet supported.
- Real-time covers spaces you are a direct member of. Messages in Google-Group-only
memberships are still listable via REST but may not push events.
Development
npm install
npm run build # or: npm run watch
Then press F5 in VS Code to launch the Extension Development Host. Other scripts:
npm run typecheck — type-check without emitting.
npm test — run the unit tests (Vitest); npm run test:watch for watch mode.
npx @vscode/vsce package — build a .vsix for local install or manual publishing.
Disclaimer
Not affiliated with, endorsed by, or sponsored by Google. "Google Chat", "Google Workspace",
and "Google Cloud" are trademarks of Google LLC; "Visual Studio Code" is a trademark of
Microsoft Corporation.
License
MIT