@elizaos/plugin-slack 2.0.0-alpha.7 → 2.0.11-beta.7

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 ADDED
@@ -0,0 +1 @@
1
+ {"message":"Not Found","documentation_url":"https://docs.github.com/rest/repos/contents#get-repository-content","status":"404"}
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # @elizaos/plugin-slack
2
+
3
+ Slack integration plugin for elizaOS agents with Socket Mode support.
4
+
5
+ ## Features
6
+
7
+ - **Socket Mode**: Real-time event handling via Slack Socket Mode
8
+ - **Message Operations**: Send, edit, delete, read messages
9
+ - **Reactions**: Add and remove emoji reactions
10
+ - **Pins**: Pin and unpin messages, list pinned items
11
+ - **Channels**: List channels, read channel history
12
+ - **User Info**: Get user profile information
13
+ - **Threads**: Full thread support with reply tracking
14
+ - **Media**: Handle file uploads and attachments
15
+ - **Custom Emoji**: List workspace custom emoji
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @elizaos/plugin-slack
21
+ # or
22
+ bun add @elizaos/plugin-slack
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ ### Required Environment Variables
28
+
29
+ ```env
30
+ # Bot Token (starts with xoxb-)
31
+ SLACK_BOT_TOKEN=xoxb-your-bot-token
32
+
33
+ # App Token for Socket Mode (starts with xapp-)
34
+ SLACK_APP_TOKEN=xapp-your-app-token
35
+ ```
36
+
37
+ ### Optional Environment Variables
38
+
39
+ ```env
40
+ # Signing Secret for request verification
41
+ SLACK_SIGNING_SECRET=your-signing-secret
42
+
43
+ # User Token for enhanced permissions (starts with xoxp-)
44
+ SLACK_USER_TOKEN=xoxp-your-user-token
45
+
46
+ # Comma-separated list of channel IDs to restrict bot to
47
+ SLACK_CHANNEL_IDS=C123456789,C987654321
48
+
49
+ # Ignore messages from other bots
50
+ SLACK_SHOULD_IGNORE_BOT_MESSAGES=false
51
+
52
+ # Only respond when mentioned
53
+ SLACK_SHOULD_RESPOND_ONLY_TO_MENTIONS=false
54
+ ```
55
+
56
+ ## Slack App Setup
57
+
58
+ 1. Create a new Slack App at https://api.slack.com/apps
59
+ 2. Enable Socket Mode in your app settings
60
+ 3. Generate an App-Level Token with `connections:write` scope
61
+ 4. Add the following Bot Token Scopes:
62
+ - `channels:history` - Read messages in public channels
63
+ - `channels:read` - View basic channel information
64
+ - `chat:write` - Send messages
65
+ - `emoji:read` - View custom emoji
66
+ - `files:read` - View files
67
+ - `groups:history` - Read messages in private channels
68
+ - `groups:read` - View basic private channel information
69
+ - `im:history` - Read direct messages
70
+ - `im:read` - View basic direct message information
71
+ - `mpim:history` - Read group direct messages
72
+ - `mpim:read` - View basic group direct message information
73
+ - `pins:read` - View pinned items
74
+ - `pins:write` - Add and remove pinned items
75
+ - `reactions:read` - View reactions
76
+ - `reactions:write` - Add and remove reactions
77
+ - `team:read` - View workspace information
78
+ - `users:read` - View basic user information
79
+ - `users:read.email` - View user email addresses
80
+
81
+ 5. Enable Events and subscribe to:
82
+ - `message.channels` - Messages in public channels
83
+ - `message.groups` - Messages in private channels
84
+ - `message.im` - Direct messages
85
+ - `message.mpim` - Group direct messages
86
+ - `app_mention` - When the app is mentioned
87
+ - `member_joined_channel` - When a user joins a channel
88
+ - `member_left_channel` - When a user leaves a channel
89
+ - `reaction_added` - When a reaction is added
90
+ - `reaction_removed` - When a reaction is removed
91
+
92
+ 6. Install the app to your workspace
93
+
94
+ ## Usage
95
+
96
+ ### Add to your agent configuration
97
+
98
+ ```typescript
99
+ import slackPlugin from "@elizaos/plugin-slack";
100
+
101
+ const agent = {
102
+ // ... other configuration
103
+ plugins: [slackPlugin],
104
+ };
105
+ ```
106
+
107
+ ### Character file configuration
108
+
109
+ ```json
110
+ {
111
+ "name": "MyAgent",
112
+ "settings": {
113
+ "slack": {
114
+ "shouldIgnoreBotMessages": true,
115
+ "shouldRespondOnlyToMentions": false
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ ## Connector capabilities
122
+
123
+ This plugin registers no elizaOS actions. Slack messaging is handled via the `MessageConnector` interface. The registered connector exposes these capabilities: `send_message`, `read_messages`, `search_messages`, `resolve_targets`, `list_rooms`, `list_servers`, `chat_context`, `user_context`, `react_message`, `edit_message`, `delete_message`, `pin_message`, `get_user`.
124
+
125
+ ## Events
126
+
127
+ The plugin emits the following events:
128
+
129
+ - `SLACK_MESSAGE_RECEIVED` - When a message is received
130
+ - `SLACK_MESSAGE_SENT` - When a message is sent
131
+ - `SLACK_REACTION_ADDED` - When a reaction is added
132
+ - `SLACK_REACTION_REMOVED` - When a reaction is removed
133
+ - `SLACK_APP_MENTION` - When the bot is mentioned
134
+ - `SLACK_MEMBER_JOINED_CHANNEL` - When a member joins a channel
135
+ - `SLACK_MEMBER_LEFT_CHANNEL` - When a member leaves a channel
136
+ - `SLACK_FILE_SHARED` - When a file is shared
137
+
138
+ ## API Reference
139
+
140
+ ### SlackService
141
+
142
+ The main service class providing direct access to Slack functionality:
143
+
144
+ ```typescript
145
+ import { SlackService, SLACK_SERVICE_NAME } from "@elizaos/plugin-slack";
146
+
147
+ // Get service from runtime
148
+ const slackService = runtime.getService(SLACK_SERVICE_NAME) as SlackService;
149
+
150
+ // Send a message
151
+ await slackService.sendMessage(channelId, "Hello!", { threadTs: "..." });
152
+
153
+ // Add a reaction
154
+ await slackService.sendReaction(channelId, messageTs, "thumbsup");
155
+
156
+ // Get user info
157
+ const user = await slackService.getUser(userId);
158
+
159
+ // List channels
160
+ const channels = await slackService.listChannels();
161
+ ```
162
+
163
+ ## Troubleshooting
164
+
165
+ ### Bot not responding to messages
166
+
167
+ 1. Verify your `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN` are correct
168
+ 2. Check that Socket Mode is enabled in your Slack app
169
+ 3. Ensure the bot has been invited to the channel
170
+ 4. Check if `SLACK_SHOULD_RESPOND_ONLY_TO_MENTIONS` is enabled
171
+
172
+ ### Permission errors
173
+
174
+ 1. Verify the bot has all required OAuth scopes
175
+ 2. Reinstall the app to your workspace after adding new scopes
176
+ 3. Check if the channel is private and the bot is a member
177
+
178
+ ### Socket Mode connection issues
179
+
180
+ 1. Verify your `SLACK_APP_TOKEN` starts with `xapp-`
181
+ 2. Check that the app-level token has `connections:write` scope
182
+ 3. Ensure only one instance of the bot is running per token
183
+
package/auto-enable.ts ADDED
@@ -0,0 +1,21 @@
1
+ // Auto-enable check for @elizaos/plugin-slack.
2
+ //
3
+ // Plugin manifest entry-point — referenced by package.json's
4
+ // `elizaos.plugin.autoEnableModule`. Keep this module light: env reads only,
5
+ // no service init, no transitive imports of the full plugin runtime. The
6
+ // auto-enable engine loads dozens of these per boot.
7
+ import type { PluginAutoEnableContext } from "@elizaos/core";
8
+
9
+ /** Enable when a `slack` connector block is present and not explicitly disabled. */
10
+ export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
11
+ const c = (ctx.config.connectors as Record<string, unknown> | undefined)
12
+ ?.slack;
13
+ if (!c || typeof c !== "object") return false;
14
+ const config = c as Record<string, unknown>;
15
+ if (config.enabled === false) return false;
16
+ // The full per-connector field check (botToken/appToken) lives in the
17
+ // central engine's isConnectorConfigured. We delegate to a simple "block
18
+ // present + not explicitly disabled" check here; the central engine's
19
+ // stricter check remains as a fallback during migration.
20
+ return true;
21
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-slack",
3
- "version": "2.0.0-alpha.7",
4
- "description": "Slack integration plugin for ElizaOS agents with Socket Mode support",
3
+ "version": "2.0.11-beta.7",
4
+ "description": "Slack integration plugin for elizaOS agents with Socket Mode support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -15,13 +15,38 @@
15
15
  "./package.json": "./package.json",
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
+ "eliza-source": {
19
+ "types": "./src/index.ts",
20
+ "import": "./src/index.ts",
21
+ "default": "./src/index.ts"
22
+ },
18
23
  "import": "./dist/index.js",
19
24
  "default": "./dist/index.js"
25
+ },
26
+ "./*.css": "./dist/*.css",
27
+ "./*": {
28
+ "types": "./dist/*.d.ts",
29
+ "eliza-source": {
30
+ "types": "./src/*.ts",
31
+ "import": "./src/*.ts",
32
+ "default": "./src/*.ts"
33
+ },
34
+ "import": "./dist/*.js",
35
+ "default": "./dist/*.js"
20
36
  }
21
37
  },
22
38
  "files": [
23
- "dist"
39
+ "dist",
40
+ "auto-enable.ts"
24
41
  ],
42
+ "elizaos": {
43
+ "plugin": {
44
+ "autoEnableModule": "./auto-enable.ts",
45
+ "capabilities": [
46
+ "messaging"
47
+ ]
48
+ }
49
+ },
25
50
  "keywords": [
26
51
  "elizaos",
27
52
  "plugin",
@@ -35,27 +60,28 @@
35
60
  "build": "bun run build.ts",
36
61
  "build:ts": "bun run build.ts",
37
62
  "dev": "bun --hot build.ts",
38
- "clean": "rm -rf dist .turbo node_modules",
39
- "test": "vitest run --passWithNoTests",
40
- "typecheck": "echo \"Typecheck skipped for release\"",
41
- "lint": "echo \"Lint skipped for release\"",
42
- "lint:check": "bun run lint",
63
+ "clean": "rm -rf dist .turbo",
64
+ "test": "vitest run",
65
+ "typecheck": "tsgo --noEmit",
66
+ "lint": "bunx @biomejs/biome check --write --unsafe .",
67
+ "lint:check": "bunx @biomejs/biome check .",
43
68
  "format": "bunx @biomejs/biome format --write .",
44
69
  "format:check": "bunx @biomejs/biome format ."
45
70
  },
46
71
  "dependencies": {
72
+ "@elizaos/core": "2.0.11-beta.7",
47
73
  "@slack/bolt": "^4.1.0",
48
- "@slack/web-api": "^7.7.0",
49
- "@elizaos/core": "2.0.0-alpha.3",
50
- "zod": "^4.3.6"
74
+ "@slack/web-api": "^7.15.2"
51
75
  },
52
76
  "devDependencies": {
77
+ "@biomejs/biome": "^2.4.14",
53
78
  "@types/node": "^25.0.3",
54
- "typescript": "^5.9.3",
55
- "@biomejs/biome": "^2.3.11"
79
+ "bun-types": "^1.2.25",
80
+ "typescript": "^6.0.3",
81
+ "vitest": "^4.1.4"
56
82
  },
57
83
  "peerDependencies": {
58
- "@elizaos/core": "2.0.0-alpha.3"
84
+ "@elizaos/core": "2.0.11-beta.7"
59
85
  },
60
86
  "publishConfig": {
61
87
  "access": "public"
@@ -107,13 +133,5 @@
107
133
  }
108
134
  }
109
135
  },
110
- "milady": {
111
- "platforms": [
112
- "node"
113
- ],
114
- "runtime": "node",
115
- "platformDetails": {
116
- "node": "Default export (Node.js)"
117
- }
118
- }
136
+ "gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
119
137
  }