chat 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 +74 -0
- package/package.json +10 -1
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,74 @@
|
|
|
1
|
+
# chat
|
|
2
|
+
|
|
3
|
+
A unified SDK for building chat bots across Slack, Microsoft Teams, and Google Chat.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install chat
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Chat, emoji } from "chat";
|
|
15
|
+
import { createSlackAdapter } from "@chat-adapter/slack";
|
|
16
|
+
import { createRedisState } from "@chat-adapter/state-redis";
|
|
17
|
+
|
|
18
|
+
const bot = new Chat({
|
|
19
|
+
userName: "mybot",
|
|
20
|
+
adapters: {
|
|
21
|
+
slack: createSlackAdapter({
|
|
22
|
+
botToken: process.env.SLACK_BOT_TOKEN!,
|
|
23
|
+
signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
state: createRedisState({ url: process.env.REDIS_URL! }),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Handle @mentions
|
|
30
|
+
bot.onNewMention(async (thread) => {
|
|
31
|
+
await thread.subscribe();
|
|
32
|
+
await thread.post(`${emoji.wave} Hello! I'm listening.`);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Handle follow-up messages
|
|
36
|
+
bot.onSubscribedMessage(async (thread, message) => {
|
|
37
|
+
await thread.post(`You said: ${message.text}`);
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Adapters
|
|
42
|
+
|
|
43
|
+
| Package | Platform |
|
|
44
|
+
|---------|----------|
|
|
45
|
+
| [@chat-adapter/slack](https://github.com/vercel-labs/chat/tree/main/packages/adapter-slack) | Slack |
|
|
46
|
+
| [@chat-adapter/teams](https://github.com/vercel-labs/chat/tree/main/packages/adapter-teams) | Microsoft Teams |
|
|
47
|
+
| [@chat-adapter/gchat](https://github.com/vercel-labs/chat/tree/main/packages/adapter-gchat) | Google Chat |
|
|
48
|
+
|
|
49
|
+
## State Adapters
|
|
50
|
+
|
|
51
|
+
| Package | Backend |
|
|
52
|
+
|---------|---------|
|
|
53
|
+
| [@chat-adapter/state-redis](https://github.com/vercel-labs/chat/tree/main/packages/state-redis) | Redis (production) |
|
|
54
|
+
| [@chat-adapter/state-ioredis](https://github.com/vercel-labs/chat/tree/main/packages/state-ioredis) | Redis via ioredis |
|
|
55
|
+
| [@chat-adapter/state-memory](https://github.com/vercel-labs/chat/tree/main/packages/state-memory) | In-memory (dev only) |
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- **Multi-platform**: Write once, deploy to Slack, Teams, and Google Chat
|
|
60
|
+
- **Thread subscriptions**: Follow conversations after @mentions
|
|
61
|
+
- **Rich cards**: JSX-based cards that convert to Block Kit, Adaptive Cards, etc.
|
|
62
|
+
- **Action callbacks**: Handle button clicks across platforms
|
|
63
|
+
- **Reactions**: Type-safe emoji with cross-platform normalization
|
|
64
|
+
- **File uploads**: Send files with messages
|
|
65
|
+
- **Direct messages**: Initiate DMs programmatically
|
|
66
|
+
- **Serverless-ready**: Pluggable state backends for distributed deployments
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
See the [main repository](https://github.com/vercel-labs/chat) for full documentation.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chat",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Unified chat abstraction for Slack, Teams, Google Chat, and Discord",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,6 +38,15 @@
|
|
|
38
38
|
"vitest": "^2.1.8"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/vercel-labs/chat.git",
|
|
44
|
+
"directory": "packages/chat-sdk"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/vercel-labs/chat#readme",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/vercel-labs/chat/issues"
|
|
49
|
+
},
|
|
41
50
|
"publishConfig": {
|
|
42
51
|
"access": "public"
|
|
43
52
|
},
|