@xwang152/claw-lark 0.1.0

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xwang152-jack
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # Lark Plugin for OpenClaw
2
+
3
+ [中文文档](./README_zh.md)
4
+
5
+ A channel plugin that enables OpenClaw to communicate via Lark (Larksuite) messaging platform.
6
+
7
+ ## Features
8
+
9
+ - **Direct Messages**: Chat with your bot one-on-one
10
+ - **Group Chats**: Add your bot to group conversations
11
+ - **Text Messages**: Send and receive text messages
12
+ - **Image Support**: Bot can send images generated by agents
13
+ - **Webhook Mode**: For individual Lark accounts (tested)
14
+ - **WebSocket Mode**: For enterprise accounts (tested, recommended)
15
+ - **Auto-Recovery**: WebSocket and Webhook servers automatically reconnect/restart on crashes
16
+
17
+ ## Requirements
18
+
19
+ - OpenClaw installed and configured
20
+ - A Lark Developer account
21
+ - A Lark app with Bot capability enabled
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ # Clone the repository
27
+ git clone https://github.com/xwang152-jack/claw-lark.git
28
+ cd claw-lark
29
+
30
+ # Install dependencies
31
+ npm install
32
+
33
+ # Install plugin into OpenClaw
34
+ openclaw plugins install --link .
35
+ ```
36
+
37
+ Or install directly via npm:
38
+
39
+ ```bash
40
+ openclaw plugins install @xwang152/claw-lark
41
+ ```
42
+
43
+ Verify installation:Restart Gateway to load the plugin
44
+ openclaw gateway restart
45
+ ```
46
+
47
+ Verify installation:
48
+
49
+ ```bash
50
+ openclaw plugins list
51
+ ```
52
+
53
+ You should see `lark` with status `loaded`.
54
+
55
+ ## Lark App Setup
56
+
57
+ 1. Go to [Lark Developer Console](https://open.larksuite.com/app)
58
+
59
+ 2. Create a new app or use an existing one
60
+
61
+ 3. Enable **Bot** capability under App Features
62
+
63
+ 4. Add the following permissions under Permissions & Scopes:
64
+
65
+ | Permission | Scope | Description |
66
+ | :--- | :--- | :--- |
67
+ | `im:message` | Message | Send and receive messages |
68
+ | `im:message.p2p_msg:readonly` | P2P Message | Read direct messages sent to the bot |
69
+ | `im:message.group_at_msg:readonly` | Group Message | Receive messages where the bot is @mentioned in groups |
70
+ | `im:message:send_as_bot` | Send | Send messages as the bot |
71
+ | `im:resource` | Resource | Upload/download images and files |
72
+
73
+ **Optional Permissions (add as needed):**
74
+
75
+ | Permission | Scope | Description |
76
+ | :--- | :--- | :--- |
77
+ | `im:message.group_msg` | Group | Read all group messages (Sensitive permission) |
78
+ | `im:message:readonly` | Read | Get historical messages |
79
+ | `im:message:update` | Edit | Update/edit sent messages |
80
+ | `im:message:recall` | Recall | Recall sent messages |
81
+ | `im:message.reactions:read` | Reaction | View message emoji reactions |
82
+
83
+ 5. Note your **App ID** and **App Secret** from Credentials & Basic Info (you'll need these for configuration)
84
+
85
+ 6. Publish your app under Version Management
86
+
87
+ ## Configuration
88
+
89
+ ### Using Config Commands
90
+
91
+ ```bash
92
+ # Required settings
93
+ openclaw config set channels.lark.accounts.default.appId 'cli_xxxxx'
94
+ openclaw config set channels.lark.accounts.default.appSecret 'your-app-secret'
95
+ openclaw config set channels.lark.accounts.default.connectionMode 'webhook'
96
+
97
+ # Optional settings
98
+ openclaw config set channels.lark.accounts.default.webhookPort 3000
99
+ openclaw config set channels.lark.accounts.default.domain 'lark'
100
+ openclaw config set channels.lark.accounts.default.dmPolicy 'open'
101
+ openclaw config set channels.lark.accounts.default.groupPolicy 'open'
102
+ openclaw config set channels.lark.accounts.default.groupMentionGated false
103
+
104
+ # Security settings (from Lark Developer Console > Events & Callbacks > Encryption Strategy)
105
+ openclaw config set channels.lark.accounts.default.encryptKey 'your-encrypt-key'
106
+ openclaw config set channels.lark.accounts.default.verificationToken 'your-verification-token'
107
+ ```
108
+
109
+ ### Using Environment Variables
110
+
111
+ For the default account, you can use environment variables:
112
+
113
+ ```bash
114
+ LARK_APP_ID=cli_xxxxx
115
+ LARK_APP_SECRET=your-app-secret
116
+
117
+ # Security settings (from Lark Developer Console > Events & Callbacks > Encryption Strategy)
118
+ LARK_ENCRYPT_KEY=your-encrypt-key # Optional, for decrypting event payloads
119
+ LARK_VERIFICATION_TOKEN=your-token # Optional, for verifying request authenticity
120
+ ```
121
+
122
+ ### Configuration Options
123
+
124
+ | Option | Type | Default | Description |
125
+ |--------|------|---------|-------------|
126
+ | `appId` | string | - | Lark App ID (required) |
127
+ | `appSecret` | string | - | Lark App Secret (required) |
128
+ | `connectionMode` | string | `websocket` | `webhook` or `websocket` |
129
+ | `webhookPort` | number | `3000` | Port for webhook server |
130
+ | `domain` | string | `feishu` | `feishu` (China) or `lark` (international) |
131
+ | `encryptKey` | string | - | Encrypt key for decrypting event payloads (from Events & Callbacks > Encryption Strategy) |
132
+ | `verificationToken` | string | - | Token for verifying request authenticity (from Events & Callbacks > Encryption Strategy) |
133
+ | `dmPolicy` | string | `pairing` | `open`, `pairing`, or `allowlist` |
134
+ | `groupPolicy` | string | `open` | `open`, `allowlist`, or `disabled` |
135
+ | `groupMentionGated` | boolean | `true` | Require @mention in groups |
136
+
137
+ ## Webhook Mode Setup
138
+
139
+ Choose the setup method based on your deployment environment.
140
+
141
+ ### 1. Development (Using ngrok)
142
+
143
+ Recommended for local development and testing.
144
+
145
+ > **Security & Privacy Notice**: ngrok exposes your local server to the internet. Keep the following in mind:
146
+ > - Never share your ngrok URL publicly — anyone with the URL can send requests to your local machine
147
+ > - Use a paid ngrok plan with authentication or IP restrictions for production use
148
+ > - Stop ngrok when not in use to close the tunnel
149
+ > - Consider using Lark's `encryptKey` and `verificationToken` for additional request validation
150
+
151
+ 1. Start ngrok to expose your local webhook server:
152
+
153
+ ```bash
154
+ ngrok http 3000
155
+ ```
156
+
157
+ 2. Copy the HTTPS URL from ngrok (e.g., `https://abc123.ngrok.io`)
158
+
159
+ 3. Configure Events & Callbacks in Lark Developer Console:
160
+ - Add event subscription: `im.message.receive_v1`
161
+ - Set Request URL to your ngrok HTTPS URL (e.g., `https://abc123.ngrok.io`)
162
+
163
+ ### 2. Production (Server Deployment)
164
+
165
+ When deploying on a server, ngrok is **not** required.
166
+
167
+ 1. **Open Port**: Ensure your server's firewall (Security Group) allows traffic on the port used by the plugin (default is `3000`).
168
+ 2. **Configure URL**: In Lark Developer Console, configure "Events & Callbacks":
169
+ - Set the "Request URL" to your server's public address: `http://your-server-ip:3000`.
170
+ 3. **(Recommended) Reverse Proxy**: Use Nginx or Caddy to set up a reverse proxy with SSL (HTTPS) and forward traffic to port `3000`.
171
+
172
+ ### 3. Start the Plugin
173
+
174
+ 1. Start OpenClaw:
175
+
176
+ ```bash
177
+ openclaw start
178
+ ```
179
+
180
+ 2. The webhook server will start automatically and handle URL verification.
181
+
182
+ ## WebSocket Mode
183
+
184
+ WebSocket mode is available for enterprise Lark accounts (Custom Apps) that support long connections. Set `connectionMode` to `websocket`:
185
+
186
+ ```bash
187
+ openclaw config set channels.lark.accounts.default.connectionMode 'websocket'
188
+ ```
189
+
190
+ **Advantages:**
191
+ - **No Public IP Needed**: No need for ngrok or reverse proxy, suitable for local or intranet environments.
192
+ - **Easy Setup**: Simply enable the "Receive events through persistent connection" toggle in the Lark Developer Console.
193
+ - **High Stability**: The plugin supports automatic reconnection.
194
+
195
+ **Configuration Steps:**
196
+ 1. Go to **Events & Callbacks** in the Lark Developer Console.
197
+ 2. Select **Receive events through persistent connection** under "Subscription Mode".
198
+ 3. Ensure the `im.message.receive_v1` event is added.
199
+
200
+ ## Multiple Accounts
201
+
202
+ You can configure multiple Lark accounts:
203
+
204
+ ```bash
205
+ openclaw config set channels.lark.accounts.work.appId 'cli_work_app'
206
+ openclaw config set channels.lark.accounts.work.appSecret 'work-secret'
207
+ openclaw config set channels.lark.accounts.personal.appId 'cli_personal_app'
208
+ openclaw config set channels.lark.accounts.personal.appSecret 'personal-secret'
209
+ ```
210
+
211
+ ## Troubleshooting
212
+
213
+ ### Bot not receiving messages
214
+
215
+ 1. Verify the event subscription `im.message.receive_v1` is added
216
+ 2. Check that the callback URL is correctly configured
217
+ 3. Ensure the required permissions are enabled
218
+ 4. Make sure the app is published (not just saved as draft)
219
+
220
+ ### Permission errors when sending images
221
+
222
+ Add the `im:resource` permission in Lark Developer Console and republish your app.
223
+
224
+ ### Webhook server not starting
225
+
226
+ Check if port 3000 is already in use. Change the port:
227
+
228
+ ```bash
229
+ openclaw config set channels.lark.accounts.default.webhookPort 3001
230
+ ```
231
+
232
+ ### Connection issues with WebSocket mode
233
+
234
+ WebSocket mode requires enterprise Lark accounts. If you have an individual account, use webhook mode instead.
235
+
236
+ ## Contributing
237
+
238
+ Issues and pull requests are welcome! If you encounter bugs or have feature requests, please open an issue at https://github.com/xwang152-jack/claw-lark/issues.
239
+
240
+ ## License
241
+
242
+ MIT
package/README_zh.md ADDED
@@ -0,0 +1,240 @@
1
+ # OpenClaw 飞书/Lark 插件
2
+
3
+ 这是一个为 OpenClaw 开发的频道插件,使 OpenClaw 能够通过飞书 (Larksuite) 平台进行通信。
4
+
5
+ ## 功能特性
6
+
7
+ - **私聊消息**:与您的机器人进行一对一对话
8
+ - **群聊消息**:将机器人加入群组对话
9
+ - **文本消息**:发送和接收文本消息
10
+ - **图片支持**:机器人可以发送由智能体生成的图片
11
+ - **Webhook 模式**:适用于个人飞书账号(已测试)
12
+ - **WebSocket 模式**:适用于企业级账号(已通过测试,推荐使用)
13
+ - **自动恢复**:WebSocket 和 Webhook 服务在崩溃时会自动重连或重启
14
+
15
+ ## 前置要求
16
+
17
+ - 已安装并配置 OpenClaw
18
+ - 飞书开发者账号
19
+ - 已启用机器人能力的飞书应用
20
+
21
+ ## 安装步骤
22
+
23
+ ```bash
24
+ # 克隆仓库
25
+ git clone https://github.com/xwang152-jack/claw-lark.git
26
+ cd claw-lark
27
+
28
+ # 安装依赖
29
+ npm install
30
+
31
+ # 将插件安装到 OpenClaw
32
+ openclaw plugins install --link .
33
+ ```
34
+
35
+ 或者直接通过 npm 安装:
36
+
37
+ ```bash
38
+ openclaw plugins install @xwang152/claw-lark
39
+ ```
40
+
41
+ 验证安装:# 重启 Gateway 以加载插件
42
+ openclaw gateway restart
43
+ ```
44
+
45
+ 验证安装:
46
+
47
+ ```bash
48
+ openclaw plugins list
49
+ ```
50
+
51
+ 您应该能看到 `lark` 插件且状态为 `loaded`。
52
+
53
+ ## 飞书应用设置
54
+
55
+ 1. 前往 [飞书开放平台](https://open.feishu.cn/app) (国内) 或 [Lark Developer Console](https://open.larksuite.com/app) (国际)
56
+
57
+ 2. 创建新应用或使用现有应用
58
+
59
+ 3. 在“应用能力”中启用 **机器人** 能力
60
+
61
+ 4. 在“权限管理”中添加以下权限:
62
+
63
+ | 权限 | 范围 | 说明 |
64
+ | :--- | :--- | :--- |
65
+ | `im:message` | 消息 | 发送和接收消息 |
66
+ | `im:message.p2p_msg:readonly` | 私聊 | 读取发给机器人的私聊消息 |
67
+ | `im:message.group_at_msg:readonly` | 群聊 | 接收群内 @机器人 的消息 |
68
+ | `im:message:send_as_bot` | 发送 | 以机器人身份发送消息 |
69
+ | `im:resource` | 媒体 | 上传和下载图片/文件 |
70
+
71
+ **可选权限(根据需求添加):**
72
+
73
+ | 权限 | 范围 | 说明 |
74
+ | :--- | :--- | :--- |
75
+ | `im:message.group_msg` | 群聊 | 读取所有群消息(敏感权限,慎用) |
76
+ | `im:message:readonly` | 读取 | 获取历史消息 |
77
+ | `im:message:update` | 编辑 | 更新/编辑已发送消息 |
78
+ | `im:message:recall` | 撤回 | 撤回已发送消息 |
79
+ | `im:message.reactions:read` | 表情 | 查看消息表情回复 |
80
+
81
+ 5. 从“凭证与基础信息”中获取 **App ID** 和 **App Secret**(配置时需要用到)
82
+
83
+ 6. 在“版本管理与发布”中发布您的应用
84
+
85
+ ## 配置说明
86
+
87
+ ### 使用配置命令
88
+
89
+ ```bash
90
+ # 必要设置
91
+ openclaw config set channels.lark.accounts.default.appId 'cli_xxxxx'
92
+ openclaw config set channels.lark.accounts.default.appSecret 'your-app-secret'
93
+ openclaw config set channels.lark.accounts.default.connectionMode 'webhook'
94
+
95
+ # 可选设置
96
+ openclaw config set channels.lark.accounts.default.webhookPort 3000
97
+ openclaw config set channels.lark.accounts.default.domain 'feishu' # 'feishu' (国内) 或 'lark' (国际)
98
+ openclaw config set channels.lark.accounts.default.dmPolicy 'open'
99
+ openclaw config set channels.lark.accounts.default.groupPolicy 'open'
100
+ openclaw config set channels.lark.accounts.default.groupMentionGated false
101
+
102
+ # 安全设置(从飞书开发者后台 > 事件订阅 > 加密策略获取)
103
+ openclaw config set channels.lark.accounts.default.encryptKey 'your-encrypt-key'
104
+ openclaw config set channels.lark.accounts.default.verificationToken 'your-verification-token'
105
+ ```
106
+
107
+ ### 使用环境变量
108
+
109
+ 对于默认账号,您可以使用环境变量:
110
+
111
+ ```bash
112
+ LARK_APP_ID=cli_xxxxx
113
+ LARK_APP_SECRET=your-app-secret
114
+
115
+ # 安全设置(从飞书开发者后台 > 事件订阅 > 加密策略获取)
116
+ LARK_ENCRYPT_KEY=your-encrypt-key # 可选,用于解密事件数据
117
+ LARK_VERIFICATION_TOKEN=your-token # 可选,用于验证请求真实性
118
+ ```
119
+
120
+ ### 配置项详情
121
+
122
+ | 选项 | 类型 | 默认值 | 描述 |
123
+ |--------|------|---------|-------------|
124
+ | `appId` | string | - | 飞书 App ID (必填) |
125
+ | `appSecret` | string | - | 飞书 App Secret (必填) |
126
+ | `connectionMode` | string | `websocket` | `webhook` 或 `websocket` |
127
+ | `webhookPort` | number | `3000` | Webhook 服务器端口 |
128
+ | `domain` | string | `feishu` | `feishu` (国内版) 或 `lark` (国际版) |
129
+ | `encryptKey` | string | - | 加密密钥(从事件订阅 > 加密策略获取) |
130
+ | `verificationToken` | string | - | 验证令牌(从事件订阅 > 加密策略获取) |
131
+ | `dmPolicy` | string | `pairing` | 私聊策略:`open`, `pairing`, 或 `allowlist` |
132
+ | `groupPolicy` | string | `open` | 群聊策略:`open`, `allowlist`, 或 `disabled` |
133
+ | `groupMentionGated` | boolean | `true` | 是否要求在群聊中 @机器人 |
134
+
135
+ ## Webhook 模式设置
136
+
137
+ 根据您的部署环境,选择相应的配置方式。
138
+
139
+ ### 1. 开发环境(使用 ngrok)
140
+
141
+ 推荐在本地开发调试时使用。
142
+
143
+ > **安全与隐私提示**:ngrok 会将您的本地服务器暴露到公网。请注意:
144
+ > - 不要公开分享您的 ngrok URL
145
+ > - 生产环境建议使用付费版 ngrok 或自建反向代理
146
+ > - 不使用时请关闭 ngrok 隧道
147
+ > - 建议配置飞书的 `encryptKey` 和 `verificationToken` 以增强安全性
148
+
149
+ 1. 启动 ngrok 暴露本地 Webhook 端口:
150
+
151
+ ```bash
152
+ ngrok http 3000
153
+ ```
154
+
155
+ 2. 从 ngrok 复制 HTTPS URL(例如:`https://abc123.ngrok.io`)
156
+
157
+ 3. 在飞书开发者后台配置“事件订阅”:
158
+ - 添加事件:`im.message.receive_v1` (接收消息 v1.0)
159
+ - 将“请求地址”设置为您的 ngrok HTTPS URL(例如:`https://abc123.ngrok.io`)
160
+
161
+ ### 2. 生产环境(服务器部署)
162
+
163
+ 在服务器上部署时,**不需要**使用 ngrok。
164
+
165
+ 1. **开放端口**:确保您的服务器防火墙(安全组)已开放插件使用的端口(默认是 `3000`)。
166
+ 2. **配置地址**:在飞书开发者后台配置“事件订阅”:
167
+ - 将“请求地址”设置为您的服务器公网地址:`http://您的服务器IP:3000`。
168
+ 3. **(推荐)反向代理**:建议使用 Nginx 或 Caddy 配置反向代理和 SSL 证书(HTTPS),然后将流量转发到 `3000` 端口。
169
+
170
+ ### 3. 启动插件
171
+
172
+ 1. 启动 OpenClaw:
173
+
174
+ ```bash
175
+ openclaw start
176
+ ```
177
+
178
+ 2. Webhook 服务器会自动启动并处理 URL 验证。
179
+
180
+ ## WebSocket 模式
181
+
182
+ WebSocket 模式适用于支持长连接的企业级飞书账号(自建应用)。将 `connectionMode` 设置为 `websocket`:
183
+
184
+ ```bash
185
+ openclaw config set channels.lark.accounts.default.connectionMode 'websocket'
186
+ ```
187
+
188
+ **优势:**
189
+ - **无需公网 IP**:不需要配置 ngrok 或反向代理,适合本地或内网环境。
190
+ - **配置简单**:只需在飞书后台开启“使用长连接接收事件”开关即可。
191
+ - **稳定性高**:插件支持自动重连。
192
+
193
+ **配置步骤:**
194
+ 1. 在飞书开发者后台 -> **事件订阅**。
195
+ 2. 在“订阅方式”中选择 **使用长连接接收事件**。
196
+ 3. 确保已添加 `im.message.receive_v1` 事件。
197
+
198
+ ## 多账号配置
199
+
200
+ 您可以配置多个飞书账号:
201
+
202
+ ```bash
203
+ openclaw config set channels.lark.accounts.work.appId 'cli_work_app'
204
+ openclaw config set channels.lark.accounts.work.appSecret 'work-secret'
205
+ openclaw config set channels.lark.accounts.personal.appId 'cli_personal_app'
206
+ openclaw config set channels.lark.accounts.personal.appSecret 'personal-secret'
207
+ ```
208
+
209
+ ## 故障排除
210
+
211
+ ### 机器人收不到消息
212
+
213
+ 1. 检查是否订阅了 `im.message.receive_v1` 事件
214
+ 2. 检查回调 URL 是否配置正确且公网可访问
215
+ 3. 检查权限是否已开启
216
+ 4. 确保应用已发布(不仅是保存草稿)
217
+
218
+ ### 发送图片权限错误
219
+
220
+ 在飞书开发者后台添加 `im:resource` 权限并重新发布应用。
221
+
222
+ ### Webhook 服务器启动失败
223
+
224
+ 检查端口 3000 是否被占用。可以修改端口:
225
+
226
+ ```bash
227
+ openclaw config set channels.lark.accounts.default.webhookPort 3001
228
+ ```
229
+
230
+ ### WebSocket 模式连接问题
231
+
232
+ WebSocket 模式需要企业级飞书账号。如果是个人账号,请使用 Webhook 模式。
233
+
234
+ ## 贡献
235
+
236
+ 欢迎提交 Issue 和 Pull Request!如果您发现 Bug 或有功能建议,请在 https://github.com/xwang152-jack/claw-lark/issues 提交。
237
+
238
+ ## 开源协议
239
+
240
+ MIT
package/index.ts ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * OpenClaw Lark Plugin
3
+ *
4
+ * Provides Lark/Feishu (Larksuite) messaging integration for OpenClaw.
5
+ * Supports WebSocket-based real-time messaging with direct
6
+ * messages and group chats.
7
+ */
8
+
9
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
10
+ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
11
+
12
+ import { larkPlugin } from "./src/channel.js";
13
+ import { setLarkRuntime } from "./src/runtime.js";
14
+
15
+ // Re-export for programmatic usage
16
+ export { larkPlugin } from "./src/channel.js";
17
+ export { createLarkClient, createLarkWSClient } from "./src/client.js";
18
+ export { monitorLarkProvider, stopMonitor } from "./src/monitor.js";
19
+ export { startWebhookServer } from "./src/webhook.js";
20
+ export type {
21
+ LarkDomain,
22
+ LarkConnectionMode,
23
+ LarkAccountConfig,
24
+ ResolvedLarkAccount,
25
+ LarkChannelConfig,
26
+ LarkMessageEvent,
27
+ ParsedMessage,
28
+ SendResult,
29
+ } from "./src/types.js";
30
+
31
+ const plugin = {
32
+ id: "lark",
33
+ name: "Lark",
34
+ description: "Lark (Larksuite) channel plugin for OpenClaw",
35
+ configSchema: emptyPluginConfigSchema(),
36
+ register(api: OpenClawPluginApi) {
37
+ setLarkRuntime(api);
38
+ api.registerChannel({ plugin: larkPlugin });
39
+ },
40
+ };
41
+
42
+ export default plugin;
@@ -0,0 +1,86 @@
1
+ {
2
+ "id": "lark",
3
+ "channels": ["lark"],
4
+ "configSchema": {
5
+ "type": "object",
6
+ "properties": {
7
+ "accounts": {
8
+ "type": "object",
9
+ "additionalProperties": {
10
+ "type": "object",
11
+ "properties": {
12
+ "enabled": {
13
+ "type": "boolean",
14
+ "default": true,
15
+ "description": "Enable this account"
16
+ },
17
+ "appId": {
18
+ "type": "string",
19
+ "description": "Lark App ID (cli_xxx)"
20
+ },
21
+ "appSecret": {
22
+ "type": "string",
23
+ "description": "Lark App Secret"
24
+ },
25
+ "encryptKey": {
26
+ "type": "string",
27
+ "description": "Encrypt key for event verification (optional)"
28
+ },
29
+ "domain": {
30
+ "type": "string",
31
+ "enum": ["lark", "feishu"],
32
+ "default": "feishu",
33
+ "description": "API domain: feishu (China) or lark (international)"
34
+ },
35
+ "connectionMode": {
36
+ "type": "string",
37
+ "enum": ["websocket", "webhook"],
38
+ "default": "websocket",
39
+ "description": "Connection mode: websocket (enterprise) or webhook (individual accounts)"
40
+ },
41
+ "verificationToken": {
42
+ "type": "string",
43
+ "description": "Verification token for webhook events (from Lark app settings)"
44
+ },
45
+ "webhookPort": {
46
+ "type": "number",
47
+ "default": 3000,
48
+ "description": "Port for webhook server (webhook mode only)"
49
+ },
50
+ "dmPolicy": {
51
+ "type": "string",
52
+ "enum": ["open", "pairing", "allowlist"],
53
+ "default": "pairing",
54
+ "description": "DM access policy"
55
+ },
56
+ "groupPolicy": {
57
+ "type": "string",
58
+ "enum": ["open", "allowlist", "disabled"],
59
+ "default": "open",
60
+ "description": "Group chat access policy"
61
+ },
62
+ "groupMentionGated": {
63
+ "type": "boolean",
64
+ "default": true,
65
+ "description": "Require @mention in group chats"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "uiHints": {
73
+ "appSecret": {
74
+ "label": "App Secret",
75
+ "sensitive": true
76
+ },
77
+ "encryptKey": {
78
+ "label": "Encrypt Key",
79
+ "sensitive": true
80
+ },
81
+ "verificationToken": {
82
+ "label": "Verification Token",
83
+ "sensitive": true
84
+ }
85
+ }
86
+ }
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@xwang152/claw-lark",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Lark/Feishu channel plugin for OpenClaw with WebSocket and Webhook support",
6
+ "license": "MIT",
7
+ "author": "jackwang",
8
+ "keywords": [
9
+ "openclaw",
10
+ "lark",
11
+ "feishu",
12
+ "plugin",
13
+ "bot"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/xwang152-jack/claw-lark.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/xwang152-jack/claw-lark/issues"
21
+ },
22
+ "homepage": "https://github.com/xwang152-jack/claw-lark#readme",
23
+ "openclaw": {
24
+ "extensions": [
25
+ "./index.ts"
26
+ ]
27
+ },
28
+ "scripts": {
29
+ "typecheck": "tsc -p tsconfig.json"
30
+ },
31
+ "dependencies": {
32
+ "@larksuiteoapi/node-sdk": "^1.37.0"
33
+ },
34
+ "peerDependencies": {
35
+ "openclaw": "^2026.1.29"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.0.0",
39
+ "openclaw": "^2026.1.29",
40
+ "typescript": "^5.0.0"
41
+ }
42
+ }
@@ -0,0 +1,28 @@
1
+ declare module "openclaw/plugin-sdk" {
2
+ export type MoltbotConfig = {
3
+ channels?: Record<string, unknown>;
4
+ };
5
+
6
+ export type OpenClawConfig = MoltbotConfig;
7
+
8
+ export type ChannelPlugin<TAccount> = Record<string, unknown>;
9
+
10
+ export type MoltbotPluginApi = {
11
+ logger: {
12
+ debug: (msg: string) => void;
13
+ info: (msg: string) => void;
14
+ warn: (msg: string) => void;
15
+ error: (msg: string) => void;
16
+ };
17
+ inbound: {
18
+ handleMessage: (args: Record<string, unknown>) => Promise<void>;
19
+ };
20
+ registerChannel: (args: { plugin: unknown }) => void;
21
+ runtime: any;
22
+ config: any;
23
+ };
24
+
25
+ export type OpenClawPluginApi = MoltbotPluginApi;
26
+
27
+ export function emptyPluginConfigSchema(): unknown;
28
+ }