Skip to main content

Google Chat CLI - Send messages from the command line

Project description

gchat

A command-line interface for Google Chat. Send messages, read conversations, and search across your Google Chat spaces - all from the terminal.

Features

  • Multi-account support - Switch between work and personal accounts
  • Send messages - Quick one-liners or interactive mode
  • Read messages - View recent conversations in any space
  • Search - Find messages by keyword, sender, or date range
  • Beautiful TUI - Rich terminal output with tables and colors
  • JSON output - Machine-readable format for scripting and automation

Installation

Using pip

pip install gchat-cli

Using Homebrew (macOS)

brew install gchat

From source

git clone https://github.com/chadsaun/gchat.git
cd gchat
pip install -e .

Quick Start

1. Set up Google Cloud credentials

Before using gchat, you need OAuth credentials from Google Cloud Console:

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable the Google Chat API
  4. Go to CredentialsCreate CredentialsOAuth client ID
  5. Select Desktop app as the application type
  6. Download the JSON file

2. Initialize gchat

gchat init

Follow the wizard to:

  • Name your account (e.g., "work" or "personal")
  • Provide the path to your credentials JSON file
  • Authenticate via browser

3. Start using gchat

# List your spaces
gchat spaces list

# Send a message
gchat send spaces/AAAA123 "Hello from the CLI!"

# Send interactively (select space, type message)
gchat send -i

# Read recent messages
gchat read spaces/AAAA123

# Search messages
gchat search spaces/AAAA123 "meeting notes"

Commands

Account Management

gchat account add [NAME]       # Add a new account
gchat account remove [NAME]    # Remove an account
gchat account list             # List all accounts
gchat account switch [NAME]    # Switch active account
gchat account current          # Show current account

Spaces

gchat spaces list              # List all spaces
gchat spaces list --format json  # JSON output
gchat spaces info SPACE_ID     # Get space details

Messaging

# Send a message
gchat send SPACE_ID "Your message"
gchat send -i                  # Interactive mode
gchat send SPACE_ID "msg" --no-confirm  # Skip confirmation

# Read messages
gchat read SPACE_ID            # Last 10 messages
gchat read SPACE_ID -n 50      # Last 50 messages
gchat read SPACE_ID --format json  # JSON output

Search

# Search by keyword
gchat search SPACE_ID "keyword"

# Filter by sender
gchat search SPACE_ID --from "john@example.com"

# Filter by date
gchat search SPACE_ID --after 2025-01-01
gchat search SPACE_ID --before 2025-01-31

# Combine filters
gchat search SPACE_ID "budget" --from "finance" --after 2025-01-01

Status

gchat status                   # Show current account and auth status
gchat status --format json     # JSON output

Multi-Account Usage

gchat supports multiple Google accounts. The active account persists until you switch:

# Add accounts
gchat account add work
gchat account add personal

# Switch between them
gchat account switch personal

# Or specify per-command
gchat spaces list --account work

JSON Output

All commands support --format json for scripting:

# Get spaces as JSON
gchat spaces list --format json | jq '.[] | .name'

# Send message and get result
gchat send SPACE_ID "Hello" --no-confirm --format json

Configuration

Configuration is stored in ~/.gchat/:

~/.gchat/
├── config.toml              # Main configuration
└── accounts/
    ├── work/
    │   ├── credentials.json # OAuth client config
    │   └── token.json       # OAuth tokens
    └── personal/
        ├── credentials.json
        └── token.json

Requirements

  • Python 3.11+
  • A Google Workspace account with Google Chat access
  • OAuth credentials from Google Cloud Console

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gchat_cli-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gchat_cli-0.1.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file gchat_cli-0.1.0.tar.gz.

File metadata

  • Download URL: gchat_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gchat_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6cf3eeb13c46fb2e3c8e71dcc5b07515492356e716a53b1c27d73468c58cb68a
MD5 ce724a60abd9fd9fd3a5b22cf0e3d3fd
BLAKE2b-256 3f78e11b0a3c79ebee5dbc8fa45c8609b1eeb2f51dbfa109d3c35bdbaf02a449

See more details on using hashes here.

Provenance

The following attestation bundles were made for gchat_cli-0.1.0.tar.gz:

Publisher: publish.yml on chadsaun/gchat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gchat_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gchat_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gchat_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3160094d00a291701927d8b5684d5e5f3a84bf612f67481f02d7cd8efc54e40
MD5 f3a5f84b52d6c5f24f938856570486dd
BLAKE2b-256 3b84c9fe7b030d65c47253b55c8bb90c39d836e3298f1baef28e3ff37866ef99

See more details on using hashes here.

Provenance

The following attestation bundles were made for gchat_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on chadsaun/gchat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page