@chat-adapter/gchat 4.0.0 → 4.0.1
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/LICENSE +9 -0
- package/README.md +93 -0
- package/package.json +11 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vercel, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @chat-adapter/gchat
|
|
2
|
+
|
|
3
|
+
Google Chat adapter for the [chat](https://github.com/vercel-labs/chat) SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install chat @chat-adapter/gchat
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Chat } from "chat";
|
|
15
|
+
import { createGoogleChatAdapter } from "@chat-adapter/gchat";
|
|
16
|
+
|
|
17
|
+
const chat = new Chat({
|
|
18
|
+
userName: "mybot",
|
|
19
|
+
adapters: {
|
|
20
|
+
gchat: createGoogleChatAdapter({
|
|
21
|
+
credentials: JSON.parse(process.env.GOOGLE_CHAT_CREDENTIALS!),
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Handle @mentions
|
|
27
|
+
chat.onNewMention(async (thread, message) => {
|
|
28
|
+
await thread.post("Hello from Google Chat!");
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
| Option | Required | Description |
|
|
35
|
+
|--------|----------|-------------|
|
|
36
|
+
| `credentials` | Yes* | Service account credentials JSON |
|
|
37
|
+
| `useADC` | No | Use Application Default Credentials instead |
|
|
38
|
+
| `pubsubTopic` | No | Pub/Sub topic for Workspace Events |
|
|
39
|
+
| `impersonateUser` | No | User email for domain-wide delegation |
|
|
40
|
+
|
|
41
|
+
*Either `credentials` or `useADC: true` is required.
|
|
42
|
+
|
|
43
|
+
## Setup
|
|
44
|
+
|
|
45
|
+
### 1. Create a Google Cloud Project
|
|
46
|
+
|
|
47
|
+
1. Go to [Google Cloud Console](https://console.cloud.google.com)
|
|
48
|
+
2. Create a new project or select existing
|
|
49
|
+
3. Enable the **Google Chat API**
|
|
50
|
+
|
|
51
|
+
### 2. Create a Service Account
|
|
52
|
+
|
|
53
|
+
1. Go to IAM & Admin → Service Accounts
|
|
54
|
+
2. Create a new service account
|
|
55
|
+
3. Download the JSON key file
|
|
56
|
+
4. Set as `GOOGLE_CHAT_CREDENTIALS` environment variable
|
|
57
|
+
|
|
58
|
+
### 3. Configure Chat App
|
|
59
|
+
|
|
60
|
+
1. Go to [Google Chat API Configuration](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat)
|
|
61
|
+
2. Configure your app:
|
|
62
|
+
- App name and avatar
|
|
63
|
+
- HTTP endpoint URL for webhooks
|
|
64
|
+
- Enable interactive features
|
|
65
|
+
|
|
66
|
+
### 4. (Optional) Pub/Sub for Workspace Events
|
|
67
|
+
|
|
68
|
+
For reaction events, you need Workspace Events via Pub/Sub:
|
|
69
|
+
|
|
70
|
+
1. Enable **Pub/Sub API** and **Workspace Events API**
|
|
71
|
+
2. Create a Pub/Sub topic
|
|
72
|
+
3. Set `pubsubTopic` in adapter options
|
|
73
|
+
4. Configure subscription to your webhook endpoint
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- Message posting and editing
|
|
78
|
+
- Thread subscriptions
|
|
79
|
+
- Reaction events (via Workspace Events)
|
|
80
|
+
- File attachments
|
|
81
|
+
- Rich cards (Google Chat Cards)
|
|
82
|
+
- Action callbacks (card buttons)
|
|
83
|
+
- Direct messages
|
|
84
|
+
- Space management
|
|
85
|
+
|
|
86
|
+
## Limitations
|
|
87
|
+
|
|
88
|
+
- **Typing indicators**: Not supported by Google Chat API
|
|
89
|
+
- **Adding reactions**: Requires domain-wide delegation (appears from impersonated user, not bot)
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-adapter/gchat",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Google Chat adapter for chat",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"googleapis": "^144.0.0",
|
|
20
|
-
"chat": "4.0.
|
|
20
|
+
"chat": "4.0.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^22.10.2",
|
|
@@ -25,6 +25,15 @@
|
|
|
25
25
|
"typescript": "^5.7.2",
|
|
26
26
|
"vitest": "^2.1.8"
|
|
27
27
|
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/vercel-labs/chat.git",
|
|
31
|
+
"directory": "packages/adapter-gchat"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/vercel-labs/chat#readme",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/vercel-labs/chat/issues"
|
|
36
|
+
},
|
|
28
37
|
"publishConfig": {
|
|
29
38
|
"access": "public"
|
|
30
39
|
},
|