@poolzin/pool-bot 2026.3.22 → 2026.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -0
- package/dist/.buildstamp +1 -1
- package/dist/acp/bindings-store.js +209 -0
- package/dist/acp/control-plane/runtime-cache.js +54 -0
- package/dist/acp/control-plane/runtime-options.js +215 -0
- package/dist/acp/control-plane/session-actor-queue.js +36 -0
- package/dist/acp/policy.js +52 -0
- package/dist/acp/runtime/errors.js +47 -0
- package/dist/acp/runtime/registry.js +86 -0
- package/dist/acp/runtime/types.js +1 -0
- package/dist/acp/translator.js +97 -0
- package/dist/agents/btw.js +280 -0
- package/dist/agents/failover-error.js +145 -47
- package/dist/agents/fast-mode.js +24 -0
- package/dist/agents/live-model-errors.js +23 -0
- package/dist/agents/model-auth-env-vars.js +44 -0
- package/dist/agents/model-auth-markers.js +69 -0
- package/dist/agents/models-config.providers.discovery.js +180 -0
- package/dist/agents/models-config.providers.static.js +480 -0
- package/dist/auto-reply/reply/typing-policy.js +15 -0
- package/dist/browser/browser-profile-manager.js +319 -0
- package/dist/browser/cdp-proxy-bypass.js +129 -0
- package/dist/browser/cdp-timeouts.js +41 -0
- package/dist/browser/chrome-extension-validator.js +406 -0
- package/dist/browser/chrome-mcp-snapshot.js +222 -0
- package/dist/browser/chrome-mcp.js +421 -0
- package/dist/browser/chrome-mcp.snapshot.js +133 -0
- package/dist/browser/errors.js +67 -0
- package/dist/browser/form-fields.js +22 -0
- package/dist/browser/output-atomic.js +44 -0
- package/dist/browser/profile-capabilities.js +47 -0
- package/dist/browser/safe-filename.js +25 -0
- package/dist/browser/snapshot-roles.js +60 -0
- package/dist/build-info.json +3 -3
- package/dist/channels/account-snapshot-fields.js +176 -0
- package/dist/channels/draft-stream-controls.js +89 -0
- package/dist/channels/inbound-debounce-policy.js +28 -0
- package/dist/channels/typing-lifecycle.js +39 -0
- package/dist/cli/program/command-registry.js +52 -0
- package/dist/commands/agent-binding.js +123 -0
- package/dist/commands/agents.commands.bind.js +280 -0
- package/dist/commands/backup-shared.js +186 -0
- package/dist/commands/backup-verify.js +236 -0
- package/dist/commands/backup.js +166 -0
- package/dist/commands/channel-account-context.js +15 -0
- package/dist/commands/channel-account.js +190 -0
- package/dist/commands/gateway-install-token.js +117 -0
- package/dist/commands/oauth-tls-preflight.js +121 -0
- package/dist/commands/ollama-setup.js +402 -0
- package/dist/commands/security-owner-only.js +86 -0
- package/dist/commands/self-hosted-provider-setup.js +207 -0
- package/dist/commands/session-store-targets.js +12 -0
- package/dist/commands/sessions-cleanup.js +97 -0
- package/dist/control-ui/assets/{index-Dvkl4Xlx.js → index-D7shnQwQ.js} +404 -388
- package/dist/control-ui/assets/index-D7shnQwQ.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/cron/cron-filters.js +150 -0
- package/dist/cron/heartbeat-policy.js +26 -0
- package/dist/gateway/device-pairing-security.js +197 -0
- package/dist/gateway/event-deduplication.js +167 -0
- package/dist/gateway/hooks-mapping.js +46 -7
- package/dist/gateway/run-tracker.js +253 -0
- package/dist/gateway/server-methods/nodes.js +14 -0
- package/dist/gateway/websocket-preauth-security.js +188 -0
- package/dist/hooks/module-loader.js +28 -0
- package/dist/infra/agent-command-binding.js +144 -0
- package/dist/infra/backup.js +328 -0
- package/dist/infra/channel-account-context.js +173 -0
- package/dist/infra/errors.js +53 -13
- package/dist/infra/exec-approvals-security.js +217 -0
- package/dist/infra/security/command-analyzer.js +257 -0
- package/dist/infra/session-cleanup.js +143 -0
- package/dist/plugins/loader.js +16 -8
- package/dist/security/external-content.js +51 -1
- package/dist/sessions/session-costs.js +228 -0
- package/dist/shared/param-key.js +16 -0
- package/dist/shared/poll-params.js +58 -0
- package/dist/shared/polls.js +55 -0
- package/docs/DASHBOARD-GAP-ANALYSIS-AND-PLAN.md +430 -0
- package/docs/FEATURES.md +523 -0
- package/docs/FINAL-IMPLEMENTATION-REVIEW.md +274 -0
- package/docs/FINAL-IMPLEMENTATION-SUMMARY.md +356 -0
- package/docs/FINAL-PROFESSIONAL-EVALUATION.md +312 -0
- package/docs/IMPLEMENTATION-PRIORITY-EVALUATION.md +298 -0
- package/docs/IMPLEMENTATION-PROGRESS.md +237 -0
- package/docs/IMPLEMENTATION-REVIEW-PHASE1-2.md +381 -0
- package/docs/IMPLEMENTATION-REVIEW-PHASE4.md +389 -0
- package/docs/IMPLEMENTATION-REVIEW-PHASE5.md +420 -0
- package/docs/IMPLEMENTATION-REVIEW-PHASE6.md +422 -0
- package/docs/IMPLEMENTATION-REVIEW-PHASE7-FINAL.md +184 -0
- package/docs/MIKRODASH-ANALYSIS.md +412 -0
- package/docs/OPENCLAW-GAP-ANALYSIS-FINAL.md +431 -0
- package/docs/OPENCLAW-VS-POOLBOT-ANALYSIS.md +351 -0
- package/docs/PHASE-7-SUMMARY.md +144 -0
- package/docs/POOLBOT-OFFICE-PLAN.md +697 -0
- package/docs/PROJECT-FINAL-STATUS.md +237 -0
- package/docs/README.md +116 -0
- package/docs/REAL-IMPROVEMENTS-EVALUATION.md +477 -0
- package/docs/SECURITY-HARDENING-IMPLEMENTATION.md +161 -0
- package/docs/channels/googlechat.md +235 -206
- package/docs/channels/irc.md +332 -0
- package/docs/channels/nostr.md +255 -168
- package/docs/components/command-palette.md +166 -0
- package/docs/components/login-gate.md +219 -0
- package/docs/getting-started/installation.md +191 -0
- package/docs/getting-started/introduction.md +120 -0
- package/docs/improvements/USAGE-GUIDE.md +359 -0
- package/docs/plans/2026-03-15-openclaw-features-implementation.md +1632 -0
- package/docs/reference/deadcode-detection.md +72 -0
- package/extensions/acpx/node_modules/.bin/acpx +21 -0
- package/extensions/agency-agents/node_modules/.bin/vite +4 -4
- package/extensions/agency-agents/node_modules/.bin/vitest +2 -2
- package/extensions/googlechat/node_modules/.bin/tsc +21 -0
- package/extensions/googlechat/node_modules/.bin/tsserver +21 -0
- package/extensions/googlechat/node_modules/.bin/vitest +21 -0
- package/extensions/googlechat/package.json +11 -28
- package/extensions/googlechat/src/googlechat-channel.test.ts +60 -0
- package/extensions/googlechat/src/googlechat-channel.ts +120 -0
- package/extensions/googlechat/src/index.ts +14 -0
- package/extensions/irc/node_modules/.bin/tsc +21 -0
- package/extensions/irc/node_modules/.bin/tsserver +21 -0
- package/extensions/irc/node_modules/.bin/vitest +21 -0
- package/extensions/irc/package.json +16 -8
- package/extensions/irc/src/index.ts +14 -0
- package/extensions/irc/src/irc-channel.test.ts +43 -0
- package/extensions/irc/src/irc-channel.ts +191 -0
- package/extensions/keyed-async-queue/node_modules/.bin/tsc +21 -0
- package/extensions/keyed-async-queue/node_modules/.bin/tsserver +21 -0
- package/extensions/keyed-async-queue/node_modules/.bin/vitest +21 -0
- package/extensions/keyed-async-queue/package.json +20 -0
- package/extensions/keyed-async-queue/src/index.ts +14 -0
- package/extensions/keyed-async-queue/src/queue.test.ts +135 -0
- package/extensions/keyed-async-queue/src/queue.ts +200 -0
- package/extensions/memory-core/node_modules/.bin/tsc +21 -0
- package/extensions/memory-core/node_modules/.bin/tsserver +21 -0
- package/extensions/memory-core/node_modules/.bin/vitest +21 -0
- package/extensions/memory-core/package.json +11 -8
- package/extensions/memory-core/src/index.ts +14 -0
- package/extensions/memory-core/src/memory-manager.test.ts +124 -0
- package/extensions/memory-core/src/memory-manager.ts +186 -0
- package/extensions/nostr/node_modules/.bin/tsc +2 -2
- package/extensions/nostr/node_modules/.bin/tsserver +2 -2
- package/extensions/nostr/node_modules/.bin/vitest +21 -0
- package/extensions/nostr/package.json +15 -24
- package/extensions/nostr/src/index.ts +14 -0
- package/extensions/nostr/src/nostr-channel.test.ts +55 -0
- package/extensions/nostr/src/nostr-channel.ts +228 -0
- package/extensions/page-agent/node_modules/.bin/vitest +2 -2
- package/extensions/test-utils/node_modules/.bin/jiti +21 -0
- package/extensions/test-utils/node_modules/.bin/playwright +21 -0
- package/extensions/test-utils/node_modules/.bin/tsx +21 -0
- package/extensions/test-utils/node_modules/.bin/vite +21 -0
- package/extensions/test-utils/node_modules/.bin/vitest +21 -0
- package/extensions/test-utils/node_modules/.bin/yaml +21 -0
- package/extensions/xyops/node_modules/.bin/vitest +2 -2
- package/package.json +2 -1
- package/dist/control-ui/assets/index-Dvkl4Xlx.js.map +0 -1
- package/extensions/googlechat/node_modules/.bin/poolbot +0 -21
- package/extensions/memory-core/node_modules/.bin/poolbot +0 -21
|
@@ -1,220 +1,249 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
3
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- Env: `GOOGLE_CHAT_SERVICE_ACCOUNT_FILE=/path/to/service-account.json`
|
|
45
|
-
- Or config: `channels.googlechat.serviceAccountFile: "/path/to/service-account.json"`.
|
|
46
|
-
8) Set the webhook audience type + value (matches your Chat app config).
|
|
47
|
-
9) Start the gateway. Google Chat will POST to your webhook path.
|
|
48
|
-
|
|
49
|
-
## Add to Google Chat
|
|
50
|
-
Once the gateway is running and your email is added to the visibility list:
|
|
51
|
-
1) Go to [Google Chat](https://chat.google.com/).
|
|
52
|
-
2) Click the **+** (plus) icon next to **Direct Messages**.
|
|
53
|
-
3) In the search bar (where you usually add people), type the **App name** you configured in the Google Cloud Console.
|
|
54
|
-
- **Note**: The bot will *not* appear in the "Marketplace" browse list because it is a private app. You must search for it by name.
|
|
55
|
-
4) Select your bot from the results.
|
|
56
|
-
5) Click **Add** or **Chat** to start a 1:1 conversation.
|
|
57
|
-
6) Send "Hello" to trigger the assistant!
|
|
58
|
-
|
|
59
|
-
## Public URL (Webhook-only)
|
|
60
|
-
Google Chat webhooks require a public HTTPS endpoint. For security, **only expose the `/googlechat` path** to the internet. Keep the Pool Bot dashboard and other sensitive endpoints on your private network.
|
|
61
|
-
|
|
62
|
-
### Option A: Tailscale Funnel (Recommended)
|
|
63
|
-
Use Tailscale Serve for the private dashboard and Funnel for the public webhook path. This keeps `/` private while exposing only `/googlechat`.
|
|
64
|
-
|
|
65
|
-
1. **Check what address your gateway is bound to:**
|
|
66
|
-
```bash
|
|
67
|
-
ss -tlnp | grep 18789
|
|
68
|
-
```
|
|
69
|
-
Note the IP address (e.g., `127.0.0.1`, `0.0.0.0`, or your Tailscale IP like `100.x.x.x`).
|
|
70
|
-
|
|
71
|
-
2. **Expose the dashboard to the tailnet only (port 8443):**
|
|
72
|
-
```bash
|
|
73
|
-
# If bound to localhost (127.0.0.1 or 0.0.0.0):
|
|
74
|
-
tailscale serve --bg --https 8443 http://127.0.0.1:18789
|
|
75
|
-
|
|
76
|
-
# If bound to Tailscale IP only (e.g., 100.106.161.80):
|
|
77
|
-
tailscale serve --bg --https 8443 http://100.106.161.80:18789
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
3. **Expose only the webhook path publicly:**
|
|
81
|
-
```bash
|
|
82
|
-
# If bound to localhost (127.0.0.1 or 0.0.0.0):
|
|
83
|
-
tailscale funnel --bg --set-path /googlechat http://127.0.0.1:18789/googlechat
|
|
84
|
-
|
|
85
|
-
# If bound to Tailscale IP only (e.g., 100.106.161.80):
|
|
86
|
-
tailscale funnel --bg --set-path /googlechat http://100.106.161.80:18789/googlechat
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
4. **Authorize the node for Funnel access:**
|
|
90
|
-
If prompted, visit the authorization URL shown in the output to enable Funnel for this node in your tailnet policy.
|
|
91
|
-
|
|
92
|
-
5. **Verify the configuration:**
|
|
93
|
-
```bash
|
|
94
|
-
tailscale serve status
|
|
95
|
-
tailscale funnel status
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Your public webhook URL will be:
|
|
99
|
-
`https://<node-name>.<tailnet>.ts.net/googlechat`
|
|
100
|
-
|
|
101
|
-
Your private dashboard stays tailnet-only:
|
|
102
|
-
`https://<node-name>.<tailnet>.ts.net:8443/`
|
|
103
|
-
|
|
104
|
-
Use the public URL (without `:8443`) in the Google Chat app config.
|
|
105
|
-
|
|
106
|
-
> Note: This configuration persists across reboots. To remove it later, run `tailscale funnel reset` and `tailscale serve reset`.
|
|
107
|
-
|
|
108
|
-
### Option B: Reverse Proxy (Caddy)
|
|
109
|
-
If you use a reverse proxy like Caddy, only proxy the specific path:
|
|
110
|
-
```caddy
|
|
111
|
-
your-domain.com {
|
|
112
|
-
reverse_proxy /googlechat* localhost:18789
|
|
113
|
-
}
|
|
1
|
+
# Google Chat Channel
|
|
2
|
+
|
|
3
|
+
Integração com Google Chat para envio e recebimento de mensagens em spaces do Google Workspace.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ **OAuth 2.0** - Autenticação segura com service accounts
|
|
8
|
+
- 💬 **Spaces** - Suporte a spaces do Google Chat
|
|
9
|
+
- 🧵 **Threads** - Respostas em threads
|
|
10
|
+
- 🔔 **Webhooks** - Recebimento via webhooks
|
|
11
|
+
- 👥 **Presence** - Tracking básico de presença
|
|
12
|
+
|
|
13
|
+
## Configuração
|
|
14
|
+
|
|
15
|
+
### 1. Criar Service Account
|
|
16
|
+
|
|
17
|
+
1. Acesse [Google Cloud Console](https://console.cloud.google.com)
|
|
18
|
+
2. Crie um novo projeto ou selecione existente
|
|
19
|
+
3. Ative a **Google Chat API**
|
|
20
|
+
4. Vá para **APIs & Services** > **Credentials**
|
|
21
|
+
5. Clique **Create Credentials** > **Service Account**
|
|
22
|
+
6. Preencha informações e clique **Create**
|
|
23
|
+
7. Na service account, vá para **Keys** > **Add Key** > **Create new key**
|
|
24
|
+
8. Selecione **JSON** e baixe o arquivo
|
|
25
|
+
|
|
26
|
+
### 2. Configurar Pool Bot
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Copiar conteúdo do JSON para config
|
|
30
|
+
poolbot config set channels.googlechat.credentials '{"client_email":"...","private_key":"..."}'
|
|
31
|
+
|
|
32
|
+
# Ou editar config manualmente
|
|
33
|
+
# ~/.poolbot/config.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 3. Configurar Space
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# ID do space (opcional)
|
|
40
|
+
poolbot config set channels.googlechat.spaceId YOUR_SPACE_ID
|
|
41
|
+
|
|
42
|
+
# Habilitar canal
|
|
43
|
+
poolbot config set channels.googlechat.enabled true
|
|
114
44
|
```
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
##
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
45
|
+
|
|
46
|
+
### 4. Adicionar Bot ao Space
|
|
47
|
+
|
|
48
|
+
1. No Google Chat, vá para o space
|
|
49
|
+
2. Clique no nome do space > **Apps**
|
|
50
|
+
3. Adicione seu bot
|
|
51
|
+
|
|
52
|
+
## Uso
|
|
53
|
+
|
|
54
|
+
### Enviar Mensagem
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { createGoogleChatChannel } from '@poolbot/googlechat'
|
|
58
|
+
|
|
59
|
+
const channel = createGoogleChatChannel({
|
|
60
|
+
credentials: {
|
|
61
|
+
client_email: 'bot@project.iam.gserviceaccount.com',
|
|
62
|
+
private_key: '-----BEGIN PRIVATE KEY-----\n...',
|
|
63
|
+
},
|
|
64
|
+
spaceId: 'spaces/AAA...',
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
await channel.connect()
|
|
68
|
+
|
|
69
|
+
await channel.sendMessage({
|
|
70
|
+
id: 'msg-1',
|
|
71
|
+
text: 'Hello from Pool Bot!',
|
|
72
|
+
threadId: 'thread-123', // Opcional
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Receber Mensagens
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// Configurar webhook no Google Chat
|
|
80
|
+
// Settings > Bots > Your Bot > Configure webhooks
|
|
81
|
+
|
|
82
|
+
// No seu servidor webhook:
|
|
83
|
+
app.post('/webhook/googlechat', async (req, res) => {
|
|
84
|
+
const message = req.body
|
|
85
|
+
|
|
86
|
+
await channel.receiveMessages((msg) => {
|
|
87
|
+
console.log('Received:', msg)
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Threads
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Enviar em thread existente
|
|
96
|
+
await channel.sendMessage({
|
|
97
|
+
text: 'Reply in thread',
|
|
98
|
+
threadId: 'thread-123',
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// Obter mensagens de thread
|
|
102
|
+
const messages = await channel.getThreadMessages('thread-123')
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Config Options
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
type GoogleChatConfig = {
|
|
109
|
+
credentials: {
|
|
110
|
+
client_email: string // Service account email
|
|
111
|
+
private_key: string // Private key (PEM format)
|
|
168
112
|
}
|
|
113
|
+
spaceId?: string // Space ID (opcional)
|
|
114
|
+
threadKey?: string // Thread key para threading
|
|
169
115
|
}
|
|
170
116
|
```
|
|
171
117
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
118
|
+
## Webhook Setup
|
|
119
|
+
|
|
120
|
+
### 1. Criar Webhook
|
|
121
|
+
|
|
122
|
+
No Google Chat:
|
|
123
|
+
1. Vá para **Configure bots**
|
|
124
|
+
2. Selecione seu bot
|
|
125
|
+
3. Em **Incoming webhooks**, clique **Add webhook**
|
|
126
|
+
4. Dê um nome e salve a URL
|
|
127
|
+
|
|
128
|
+
### 2. Configurar no Pool Bot
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
poolbot config set channels.googlechat.webhookUrl YOUR_WEBHOOK_URL
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 3. Handler
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
// Exemplo com Express
|
|
138
|
+
app.post('/googlechat', (req, res) => {
|
|
139
|
+
const { text, user, space } = req.body
|
|
140
|
+
|
|
141
|
+
// Processar mensagem
|
|
142
|
+
handleMessage({
|
|
143
|
+
from: user.displayName,
|
|
144
|
+
text: text,
|
|
145
|
+
space: space.name,
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
res.sendStatus(200)
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Limitações
|
|
153
|
+
|
|
154
|
+
- ❌ Sem suporte a mensagens diretas (apenas spaces)
|
|
155
|
+
- ❌ Presence tracking limitado
|
|
156
|
+
- ⚠️ Webhooks requerem servidor público
|
|
157
|
+
- ⚠️ Service account necessária
|
|
178
158
|
|
|
179
159
|
## Troubleshooting
|
|
180
160
|
|
|
181
|
-
###
|
|
182
|
-
|
|
161
|
+
### Erro de Autenticação
|
|
162
|
+
|
|
183
163
|
```
|
|
184
|
-
|
|
164
|
+
Error: Google Chat connection failed: invalid_grant
|
|
185
165
|
```
|
|
186
166
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
167
|
+
**Solução:**
|
|
168
|
+
- Verificar se service account está ativa
|
|
169
|
+
- Regenerar chave JSON
|
|
170
|
+
- Verificar permissões da API
|
|
171
|
+
|
|
172
|
+
### Space não encontrado
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Error: Space not found: spaces/XXX
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Solução:**
|
|
179
|
+
- Verificar space ID
|
|
180
|
+
- Adicionar bot ao space
|
|
181
|
+
- Verificar permissões
|
|
182
|
+
|
|
183
|
+
### Webhook não funciona
|
|
184
|
+
|
|
185
|
+
**Solução:**
|
|
186
|
+
- Verificar URL do webhook
|
|
187
|
+
- Configurar firewall/SSL
|
|
188
|
+
- Testar com curl:
|
|
189
|
+
```bash
|
|
190
|
+
curl -X POST YOUR_WEBHOOK_URL \
|
|
191
|
+
-H "Content-Type: application/json" \
|
|
192
|
+
-d '{"text":"test"}'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Exemplos
|
|
196
|
+
|
|
197
|
+
### Notificação Automática
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// Enviar notificação diária
|
|
201
|
+
cron.schedule('0 9 * * *', async () => {
|
|
202
|
+
await channel.sendMessage({
|
|
203
|
+
text: 'Bom dia! Aqui está o resumo de hoje...',
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Resposta Automática
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
await channel.receiveMessages((msg) => {
|
|
212
|
+
if (msg.text.includes('preço')) {
|
|
213
|
+
channel.sendMessage({
|
|
214
|
+
text: 'Nossos planos começam em R$ 99/mês',
|
|
215
|
+
threadId: msg.threadId,
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
})
|
|
209
219
|
```
|
|
210
220
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
-
|
|
221
|
+
## API Reference
|
|
222
|
+
|
|
223
|
+
### Methods
|
|
224
|
+
|
|
225
|
+
- `connect()` - Conectar ao Google Chat
|
|
226
|
+
- `disconnect()` - Desconectar
|
|
227
|
+
- `sendMessage(message)` - Enviar mensagem
|
|
228
|
+
- `receiveMessages(callback)` - Configurar receiver
|
|
229
|
+
- `getThreadMessages(threadId)` - Obter thread
|
|
230
|
+
- `getPresences()` - Obter presenças (limitado)
|
|
231
|
+
|
|
232
|
+
### Events
|
|
233
|
+
|
|
234
|
+
- `message` - Nova mensagem recebida
|
|
235
|
+
- `connect` - Conexão estabelecida
|
|
236
|
+
- `disconnect` - Desconectado
|
|
237
|
+
- `error` - Erro na conexão
|
|
238
|
+
|
|
239
|
+
## Arquivos Relacionados
|
|
240
|
+
|
|
241
|
+
- `extensions/googlechat/src/googlechat-channel.ts` - Implementação
|
|
242
|
+
- `extensions/googlechat/src/index.ts` - Entry point
|
|
243
|
+
- `extensions/googlechat/package.json` - Dependências
|
|
244
|
+
|
|
245
|
+
## Links Relacionados
|
|
216
246
|
|
|
217
|
-
|
|
218
|
-
- [
|
|
219
|
-
- [
|
|
220
|
-
- [Reactions](/tools/reactions)
|
|
247
|
+
- [Google Chat API Docs](https://developers.google.com/chat)
|
|
248
|
+
- [Service Accounts](https://cloud.google.com/iam/docs/service-accounts)
|
|
249
|
+
- [Webhooks Guide](https://developers.google.com/chat/api/guides/v1/webhooks)
|