Skip to content

Commit a4bed5e

Browse files
sshrushanth-kssk-keeper
authored andcommitted
KC-1368: Add gchat-app-setup for Google Chat integration (#2252)
* Add gchat-app-setup for Google Chat Service Mode integration. Collect and store Google Chat/Pub/Sub credentials in a vault record and generate docker-compose, matching the Slack/Teams setup flow. * Require a file path for Google Chat service account JSON. Drop unreliable inline JSON paste at the gchat-app-setup prompt; service account keys are too large for single-line terminal input. * updated to latest annotations * addressed review comments * Validate GChat project ID against Pub/Sub paths and the service account. Reject full resource names whose project differs from GOOGLE_PROJECT_ID, require confirmation when the project override disagrees with the SA JSON, and drop unused _is_valid_subscription_id.
1 parent 3a1a30b commit a4bed5e

9 files changed

Lines changed: 716 additions & 26 deletions

File tree

keepercommander/command_categories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
'Service Mode REST API': {
8585
'service-create', 'service-add-config', 'service-start', 'service-stop', 'service-status',
8686
'service-config-add', 'service-docker-setup', 'slack-app-setup', 'teams-app-setup',
87-
'sailpoint-app-setup'
87+
'sailpoint-app-setup', 'gchat-app-setup'
8888
},
8989

9090
# Email Configuration Commands

keepercommander/commands/start_service.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
from ..service.commands.handle_service import StartService, StopService, ServiceStatus
1515
from ..service.commands.service_docker_setup import ServiceDockerSetupCommand
1616
from ..service.commands.integrations import (
17-
SlackAppSetupCommand, TeamsAppSetupCommand, SailPointAppSetupCommand,
17+
GChatAppSetupCommand,
18+
SlackAppSetupCommand,
19+
TeamsAppSetupCommand,
20+
SailPointAppSetupCommand,
1821
)
1922

2023
def register_commands(commands):
@@ -27,6 +30,7 @@ def register_commands(commands):
2730
commands['slack-app-setup'] = SlackAppSetupCommand()
2831
commands['teams-app-setup'] = TeamsAppSetupCommand()
2932
commands['sailpoint-app-setup'] = SailPointAppSetupCommand()
33+
commands['gchat-app-setup'] = GChatAppSetupCommand()
3034

3135
def register_command_info(aliases, command_info):
3236
service_classes = [
@@ -39,9 +43,10 @@ def register_command_info(aliases, command_info):
3943
SlackAppSetupCommand,
4044
TeamsAppSetupCommand,
4145
SailPointAppSetupCommand,
46+
GChatAppSetupCommand,
4247
]
4348

4449
for service_class in service_classes:
4550
parser = service_class()
4651
p = parser.get_parser()
47-
command_info[p.prog] = p.description
52+
command_info[p.prog] = p.description

keepercommander/service/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ The Service Mode module for Keeper Commander enables REST API integration by pro
2020
| `service-config-add` | Add new API configuration and command access settings |
2121
| `service-docker-setup` | Automated Docker service mode setup with KSM configuration |
2222
| `slack-app-setup` | Automated Slack App integration setup with Commander Service Mode |
23+
| `teams-app-setup` | Automated Teams App integration setup with Commander Service Mode |
24+
| `gchat-app-setup` | Automated Google Chat App integration setup with Commander Service Mode |
2325

2426
### Security Features
2527
- API key authentication
@@ -500,6 +502,60 @@ This automates the complete setup for Slack App integration:
500502

501503
The command generates a complete `docker-compose.yml` with both Commander service and Slack App service configured.
502504

505+
### Google Chat App Integration Setup
506+
507+
For integrating Commander Service Mode with Google Chat, use the `gchat-app-setup` command:
508+
509+
```bash
510+
My Vault> gchat-app-setup
511+
```
512+
513+
This automates the complete setup for Google Chat App integration:
514+
- **Phase 1**: Runs Docker setup (same as `service-docker-setup`)
515+
- **Phase 2**: Configures Google Chat App integration
516+
- Collects service account JSON (Pub/Sub + Chat API worker credentials)
517+
- Collects Google Project ID (defaults from the service account JSON when omitted)
518+
- Collects Pub/Sub Topic ID, Subscription ID, Approvals Space ID, and slash command IDs
519+
- Creates Google Chat configuration record
520+
- Updates `docker-compose.yml` with Google Chat App service
521+
- Supports optional EPM and Device Approval integrations
522+
523+
**Configuration Options:**
524+
- Port selection (default: 8900)
525+
- Ngrok/Cloudflare tunneling for public URL exposure
526+
- Google Chat service account / Pub/Sub / space credentials
527+
- Optional EPM integration
528+
- Optional SSO Cloud Device Approval
529+
530+
The command generates a complete `docker-compose.yml` with both Commander service and Google Chat App service configured.
531+
532+
**Vault config record fields** (read by the Google Chat app via KSM / `GCHAT_RECORD`):
533+
534+
| Field label | Type | Description |
535+
|-------------|------|-------------|
536+
| `google_service_account_json` | secret | Full GCP service account JSON (Pub/Sub + Chat API) |
537+
| `google_project_id` | text | GCP project ID |
538+
| `google_topic_id` | text | Pub/Sub topic ID (short form) |
539+
| `google_subscription_id` | text | Pub/Sub subscription ID (short form) |
540+
| `chat_approvals_space_id` | text | Google Chat space ID (`spaces/...`) |
541+
| `chat_command_request_record_id` | text | Slash command ID for `/keeper-request-record` |
542+
| `chat_command_request_folder_id` | text | Slash command ID for `/keeper-request-folder` |
543+
| `chat_command_one_time_share_id` | text | Slash command ID for `/keeper-one-time-share` |
544+
| `pedm_enabled` | text | `true` / `false` |
545+
| `pedm_polling_interval` | text | Seconds |
546+
| `device_approval_enabled` | text | `true` / `false` |
547+
| `device_approval_polling_interval` | text | Seconds |
548+
549+
**Generated compose environment for the Google Chat service:**
550+
551+
| Env var | Value |
552+
|---------|-------|
553+
| `KSM_CONFIG` | Base64 KSM config |
554+
| `COMMANDER_RECORD` | Commander Docker config record UID |
555+
| `GCHAT_RECORD` | Google Chat config record UID |
556+
557+
Image name used in compose: `keeper/gchat-app:latest`.
558+
503559
---
504560

505561
### Manual Authentication Methods (Alternative)

keepercommander/service/commands/integrations/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
"""Integration setup commands."""
1313

14+
from .gchat_app_setup import GChatAppSetupCommand
1415
from .integration_setup_base import IntegrationSetupCommand
1516
from .slack_app_setup import SlackAppSetupCommand
1617
from .teams_app_setup import TeamsAppSetupCommand
1718
from .sailpoint_app_setup import SailPointAppSetupCommand
1819

1920
__all__ = [
2021
'IntegrationSetupCommand',
22+
'GChatAppSetupCommand',
2123
'SlackAppSetupCommand',
2224
'TeamsAppSetupCommand',
2325
'SailPointAppSetupCommand',

0 commit comments

Comments
 (0)