@poolzin/pool-bot 2026.3.21 → 2026.3.23

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.
Files changed (124) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/dist/acp/bindings-store.js +209 -0
  3. package/dist/acp/control-plane/runtime-cache.js +54 -0
  4. package/dist/acp/control-plane/runtime-options.js +215 -0
  5. package/dist/acp/control-plane/session-actor-queue.js +36 -0
  6. package/dist/acp/runtime/errors.js +47 -0
  7. package/dist/acp/runtime/registry.js +86 -0
  8. package/dist/acp/runtime/types.js +1 -0
  9. package/dist/acp/translator.js +97 -0
  10. package/dist/agents/failover-error.js +145 -47
  11. package/dist/browser/browser-profile-manager.js +319 -0
  12. package/dist/browser/cdp-proxy-bypass.js +129 -0
  13. package/dist/browser/cdp-timeouts.js +41 -0
  14. package/dist/browser/chrome-extension-validator.js +406 -0
  15. package/dist/browser/chrome-mcp-snapshot.js +222 -0
  16. package/dist/browser/chrome-mcp.js +421 -0
  17. package/dist/browser/chrome-mcp.snapshot.js +133 -0
  18. package/dist/browser/errors.js +67 -0
  19. package/dist/browser/form-fields.js +22 -0
  20. package/dist/browser/output-atomic.js +44 -0
  21. package/dist/browser/profile-capabilities.js +47 -0
  22. package/dist/browser/safe-filename.js +25 -0
  23. package/dist/browser/snapshot-roles.js +60 -0
  24. package/dist/build-info.json +3 -3
  25. package/dist/commands/security-owner-only.js +86 -0
  26. package/dist/control-ui/assets/{index-Dvkl4Xlx.js → index-D7shnQwQ.js} +404 -388
  27. package/dist/control-ui/assets/index-D7shnQwQ.js.map +1 -0
  28. package/dist/control-ui/index.html +1 -1
  29. package/dist/cron/cron-filters.js +150 -0
  30. package/dist/gateway/device-pairing-security.js +197 -0
  31. package/dist/gateway/event-deduplication.js +167 -0
  32. package/dist/gateway/run-tracker.js +253 -0
  33. package/dist/gateway/server-methods/nodes.js +14 -0
  34. package/dist/gateway/websocket-preauth-security.js +188 -0
  35. package/dist/infra/errors.js +53 -13
  36. package/dist/infra/exec-approvals-security.js +217 -0
  37. package/dist/infra/security/command-analyzer.js +257 -0
  38. package/dist/plugins/loader.js +16 -8
  39. package/dist/security/external-content.js +51 -1
  40. package/dist/sessions/session-costs.js +228 -0
  41. package/dist/shared/param-key.js +16 -0
  42. package/dist/shared/poll-params.js +58 -0
  43. package/dist/shared/polls.js +55 -0
  44. package/docs/DASHBOARD-GAP-ANALYSIS-AND-PLAN.md +430 -0
  45. package/docs/FEATURES.md +523 -0
  46. package/docs/FINAL-IMPLEMENTATION-REVIEW.md +274 -0
  47. package/docs/FINAL-IMPLEMENTATION-SUMMARY.md +356 -0
  48. package/docs/FINAL-PROFESSIONAL-EVALUATION.md +312 -0
  49. package/docs/IMPLEMENTATION-PRIORITY-EVALUATION.md +298 -0
  50. package/docs/IMPLEMENTATION-PROGRESS.md +237 -0
  51. package/docs/IMPLEMENTATION-REVIEW-PHASE1-2.md +381 -0
  52. package/docs/IMPLEMENTATION-REVIEW-PHASE4.md +389 -0
  53. package/docs/IMPLEMENTATION-REVIEW-PHASE5.md +420 -0
  54. package/docs/IMPLEMENTATION-REVIEW-PHASE6.md +422 -0
  55. package/docs/IMPLEMENTATION-REVIEW-PHASE7-FINAL.md +184 -0
  56. package/docs/MIKRODASH-ANALYSIS.md +412 -0
  57. package/docs/OPENCLAW-GAP-ANALYSIS-FINAL.md +431 -0
  58. package/docs/OPENCLAW-VS-POOLBOT-ANALYSIS.md +351 -0
  59. package/docs/PHASE-7-SUMMARY.md +144 -0
  60. package/docs/POOLBOT-OFFICE-PLAN.md +697 -0
  61. package/docs/PROJECT-FINAL-STATUS.md +237 -0
  62. package/docs/README.md +116 -0
  63. package/docs/REAL-IMPROVEMENTS-EVALUATION.md +477 -0
  64. package/docs/SECURITY-HARDENING-IMPLEMENTATION.md +161 -0
  65. package/docs/channels/googlechat.md +235 -206
  66. package/docs/channels/irc.md +332 -0
  67. package/docs/channels/nostr.md +255 -168
  68. package/docs/components/command-palette.md +166 -0
  69. package/docs/components/login-gate.md +219 -0
  70. package/docs/getting-started/installation.md +191 -0
  71. package/docs/getting-started/introduction.md +120 -0
  72. package/docs/improvements/USAGE-GUIDE.md +359 -0
  73. package/docs/plans/2026-03-15-openclaw-features-implementation.md +1632 -0
  74. package/docs/reference/deadcode-detection.md +72 -0
  75. package/extensions/acpx/node_modules/.bin/acpx +21 -0
  76. package/extensions/agency-agents/node_modules/.bin/vite +4 -4
  77. package/extensions/agency-agents/node_modules/.bin/vitest +2 -2
  78. package/extensions/googlechat/node_modules/.bin/tsc +21 -0
  79. package/extensions/googlechat/node_modules/.bin/tsserver +21 -0
  80. package/extensions/googlechat/node_modules/.bin/vitest +21 -0
  81. package/extensions/googlechat/package.json +11 -28
  82. package/extensions/googlechat/src/googlechat-channel.test.ts +60 -0
  83. package/extensions/googlechat/src/googlechat-channel.ts +120 -0
  84. package/extensions/googlechat/src/index.ts +14 -0
  85. package/extensions/irc/node_modules/.bin/tsc +21 -0
  86. package/extensions/irc/node_modules/.bin/tsserver +21 -0
  87. package/extensions/irc/node_modules/.bin/vitest +21 -0
  88. package/extensions/irc/package.json +16 -8
  89. package/extensions/irc/src/index.ts +14 -0
  90. package/extensions/irc/src/irc-channel.test.ts +43 -0
  91. package/extensions/irc/src/irc-channel.ts +191 -0
  92. package/extensions/keyed-async-queue/node_modules/.bin/tsc +21 -0
  93. package/extensions/keyed-async-queue/node_modules/.bin/tsserver +21 -0
  94. package/extensions/keyed-async-queue/node_modules/.bin/vitest +21 -0
  95. package/extensions/keyed-async-queue/package.json +20 -0
  96. package/extensions/keyed-async-queue/src/index.ts +14 -0
  97. package/extensions/keyed-async-queue/src/queue.test.ts +135 -0
  98. package/extensions/keyed-async-queue/src/queue.ts +200 -0
  99. package/extensions/memory-core/node_modules/.bin/tsc +21 -0
  100. package/extensions/memory-core/node_modules/.bin/tsserver +21 -0
  101. package/extensions/memory-core/node_modules/.bin/vitest +21 -0
  102. package/extensions/memory-core/package.json +11 -8
  103. package/extensions/memory-core/src/index.ts +14 -0
  104. package/extensions/memory-core/src/memory-manager.test.ts +124 -0
  105. package/extensions/memory-core/src/memory-manager.ts +186 -0
  106. package/extensions/nostr/node_modules/.bin/tsc +2 -2
  107. package/extensions/nostr/node_modules/.bin/tsserver +2 -2
  108. package/extensions/nostr/node_modules/.bin/vitest +21 -0
  109. package/extensions/nostr/package.json +15 -24
  110. package/extensions/nostr/src/index.ts +14 -0
  111. package/extensions/nostr/src/nostr-channel.test.ts +55 -0
  112. package/extensions/nostr/src/nostr-channel.ts +228 -0
  113. package/extensions/page-agent/node_modules/.bin/vitest +2 -2
  114. package/extensions/test-utils/node_modules/.bin/jiti +21 -0
  115. package/extensions/test-utils/node_modules/.bin/playwright +21 -0
  116. package/extensions/test-utils/node_modules/.bin/tsx +21 -0
  117. package/extensions/test-utils/node_modules/.bin/vite +21 -0
  118. package/extensions/test-utils/node_modules/.bin/vitest +21 -0
  119. package/extensions/test-utils/node_modules/.bin/yaml +21 -0
  120. package/extensions/xyops/node_modules/.bin/vitest +2 -2
  121. package/package.json +2 -1
  122. package/dist/control-ui/assets/index-Dvkl4Xlx.js.map +0 -1
  123. package/extensions/googlechat/node_modules/.bin/poolbot +0 -21
  124. package/extensions/memory-core/node_modules/.bin/poolbot +0 -21
@@ -1,220 +1,249 @@
1
- ---
2
- summary: "Google Chat app support status, capabilities, and configuration"
3
- read_when:
4
- - Working on Google Chat channel features
5
- ---
6
- # Google Chat (Chat API)
7
-
8
- Status: ready for DMs + spaces via Google Chat API webhooks (HTTP only).
9
-
10
- ## Quick setup (beginner)
11
- 1) Create a Google Cloud project and enable the **Google Chat API**.
12
- - Go to: [Google Chat API Credentials](https://console.cloud.google.com/apis/api/chat.googleapis.com/credentials)
13
- - Enable the API if it is not already enabled.
14
- 2) Create a **Service Account**:
15
- - Press **Create Credentials** > **Service Account**.
16
- - Name it whatever you want (e.g., `poolbot-chat`).
17
- - Leave permissions blank (press **Continue**).
18
- - Leave principals with access blank (press **Done**).
19
- 3) Create and download the **JSON Key**:
20
- - In the list of service accounts, click on the one you just created.
21
- - Go to the **Keys** tab.
22
- - Click **Add Key** > **Create new key**.
23
- - Select **JSON** and press **Create**.
24
- 4) Store the downloaded JSON file on your gateway host (e.g., `~/.poolbot/googlechat-service-account.json`).
25
- 5) Create a Google Chat app in the [Google Cloud Console Chat Configuration](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat):
26
- - Fill in the **Application info**:
27
- - **App name**: (e.g. `Pool Bot`)
28
- - **Avatar URL**: (e.g. `https://molt.bot/logo.png`)
29
- - **Description**: (e.g. `Personal AI Assistant`)
30
- - Enable **Interactive features**.
31
- - Under **Functionality**, check **Join spaces and group conversations**.
32
- - Under **Connection settings**, select **HTTP endpoint URL**.
33
- - Under **Triggers**, select **Use a common HTTP endpoint URL for all triggers** and set it to your gateway's public URL followed by `/googlechat`.
34
- - *Tip: Run `poolbot status` to find your gateway's public URL.*
35
- - Under **Visibility**, check **Make this Chat app available to specific people and groups in <Your Domain>**.
36
- - Enter your email address (e.g. `user@example.com`) in the text box.
37
- - Click **Save** at the bottom.
38
- 6) **Enable the app status**:
39
- - After saving, **refresh the page**.
40
- - Look for the **App status** section (usually near the top or bottom after saving).
41
- - Change the status to **Live - available to users**.
42
- - Click **Save** again.
43
- 7) Configure Pool Bot with the service account path + webhook audience:
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. 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
- With this config, any request to `your-domain.com/` will be ignored or returned as 404, while `your-domain.com/googlechat` is safely routed to Pool Bot.
116
-
117
- ### Option C: Cloudflare Tunnel
118
- Configure your tunnel's ingress rules to only route the webhook path:
119
- - **Path**: `/googlechat` -> `http://localhost:18789/googlechat`
120
- - **Default Rule**: HTTP 404 (Not Found)
121
-
122
- ## How it works
123
-
124
- 1. Google Chat sends webhook POSTs to the gateway. Each request includes an `Authorization: Bearer <token>` header.
125
- 2. Pool Bot verifies the token against the configured `audienceType` + `audience`:
126
- - `audienceType: "app-url"` → audience is your HTTPS webhook URL.
127
- - `audienceType: "project-number"` audience is the Cloud project number.
128
- 3. Messages are routed by space:
129
- - DMs use session key `agent:<agentId>:googlechat:dm:<spaceId>`.
130
- - Spaces use session key `agent:<agentId>:googlechat:group:<spaceId>`.
131
- 4. DM access is pairing by default. Unknown senders receive a pairing code; approve with:
132
- - `poolbot pairing approve googlechat <code>`
133
- 5. Group spaces require @-mention by default. Use `botUser` if mention detection needs the app’s user name.
134
-
135
- ## Targets
136
- Use these identifiers for delivery and allowlists:
137
- - Direct messages: `users/<userId>` or `users/<email>` (email addresses are accepted).
138
- - Spaces: `spaces/<spaceId>`.
139
-
140
- ## Config highlights
141
- ```json5
142
- {
143
- channels: {
144
- "googlechat": {
145
- enabled: true,
146
- serviceAccountFile: "/path/to/service-account.json",
147
- audienceType: "app-url",
148
- audience: "https://gateway.example.com/googlechat",
149
- webhookPath: "/googlechat",
150
- botUser: "users/1234567890", // optional; helps mention detection
151
- dm: {
152
- policy: "pairing",
153
- allowFrom: ["users/1234567890", "name@example.com"]
154
- },
155
- groupPolicy: "allowlist",
156
- groups: {
157
- "spaces/AAAA": {
158
- allow: true,
159
- requireMention: true,
160
- users: ["users/1234567890"],
161
- systemPrompt: "Short answers only."
162
- }
163
- },
164
- actions: { reactions: true },
165
- typingIndicator: "message",
166
- mediaMaxMb: 20
167
- }
45
+
46
+ ### 4. Adicionar Bot ao Space
47
+
48
+ 1. No Google Chat, 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
- Notes:
173
- - Service account credentials can also be passed inline with `serviceAccount` (JSON string).
174
- - Default webhook path is `/googlechat` if `webhookPath` isn’t set.
175
- - Reactions are available via the `reactions` tool and `channels action` when `actions.reactions` is enabled.
176
- - `typingIndicator` supports `none`, `message` (default), and `reaction` (reaction requires user OAuth).
177
- - Attachments are downloaded through the Chat API and stored in the media pipeline (size capped by `mediaMaxMb`).
118
+ ## Webhook Setup
119
+
120
+ ### 1. Criar Webhook
121
+
122
+ No Google Chat:
123
+ 1. 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
- ### 405 Method Not Allowed
182
- If Google Cloud Logs Explorer shows errors like:
161
+ ### Erro de Autenticação
162
+
183
163
  ```
184
- status code: 405, reason phrase: HTTP error response: HTTP/1.1 405 Method Not Allowed
164
+ Error: Google Chat connection failed: invalid_grant
185
165
  ```
186
166
 
187
- This means the webhook handler isn't registered. Common causes:
188
- 1. **Channel not configured**: The `channels.googlechat` section is missing from your config. Verify with:
189
- ```bash
190
- poolbot config get channels.googlechat
191
- ```
192
- If it returns "Config path not found", add the configuration (see [Config highlights](#config-highlights)).
193
-
194
- 2. **Plugin not enabled**: Check plugin status:
195
- ```bash
196
- poolbot plugins list | grep googlechat
197
- ```
198
- If it shows "disabled", add `plugins.entries.googlechat.enabled: true` to your config.
199
-
200
- 3. **Gateway not restarted**: After adding config, restart the gateway:
201
- ```bash
202
- poolbot gateway restart
203
- ```
204
-
205
- Verify the channel is running:
206
- ```bash
207
- poolbot channels status
208
- # Should show: Google Chat default: enabled, configured, ...
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
- ### Other issues
212
- - Check `poolbot channels status --probe` for auth errors or missing audience config.
213
- - If no messages arrive, confirm the Chat app's webhook URL + event subscriptions.
214
- - If mention gating blocks replies, set `botUser` to the app's user resource name and verify `requireMention`.
215
- - Use `poolbot logs --follow` while sending a test message to see if requests reach the gateway.
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
- Related docs:
218
- - [Gateway configuration](/gateway/configuration)
219
- - [Security](/gateway/security)
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)