Interactive Google Chat CLI for sending DMs, posting to spaces, and running a live terminal chat shell as your authenticated Google account.
Features:
- resolve an existing DM by email
- create a DM if one does not exist
- send a DM
- send a message to a known space
- list spaces
- list recent messages in a space
- run an interactive live shell with polling
Files:
gchat-setup— OAuth setup helpergchat— main non-interactive CLIgchat-live— interactive live chat shellsetup.py— underlying setup scriptgchat.py— main non-interactive implementationgchat_live.py— interactive REPL/watch mode
- Create a Google OAuth desktop client in Google Cloud Console.
- Enable the Google Chat API for that project.
- Download the OAuth client JSON.
- Store it:
~/docs/google-chat-cli/gchat-setup --client-secret /path/to/client_secret.json - Get auth URL:
~/docs/google-chat-cli/gchat-setup --auth-url - Open it, approve, then paste back the full redirected URL.
- Exchange it:
~/docs/google-chat-cli/gchat-setup --auth-code 'PASTE_FULL_REDIRECT_URL_HERE' - Verify:
~/docs/google-chat-cli/gchat-setup --check
Important: if you authenticated before the live CLI existed, re-run auth once so the token includes message read scope:
~/docs/google-chat-cli/gchat-setup --auth-url
then
~/docs/google-chat-cli/gchat-setup --auth-code 'PASTE_FULL_REDIRECT_URL_HERE'
Stored auth lives in ~/.google-chat-cli/.
List spaces:
~/docs/google-chat-cli/gchat spaces-list --max 20
Resolve a DM by email:
~/docs/google-chat-cli/gchat dm-resolve person@example.com --create-if-missing
Send a DM:
~/docs/google-chat-cli/gchat send-dm person@example.com 'hey, quick note'
List recent messages in a space:
~/docs/google-chat-cli/gchat messages-list spaces/AAAA1234567 --max 20
Send to a known space:
~/docs/google-chat-cli/gchat send-space spaces/AAAA1234567 'status update here'
Interactive live shell:
~/docs/google-chat-cli/gchat-live
Jump straight into a DM and watch:
~/docs/google-chat-cli/gchat-live --dm person@example.com --watch
- This uses user OAuth and sends messages as you.
- DM creation relies on Google Chat API
spaces.setupandspaces.findDirectMessage. - If the other person blocks you, or org policy forbids it, DM creation will fail.
- If you use multiple Google accounts, authorize the right one. Google will happily let you shoot yourself in the foot.