@lansenger-pm/openclaw-lansenger-channel 3.2.7 → 3.2.8
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/package.json
CHANGED
|
@@ -19,6 +19,56 @@ However, Markdown and file attachments are **mutually exclusive**. If you need b
|
|
|
19
19
|
|
|
20
20
|
**Never put raw Markdown in lansenger_send_text / send-text** — it displays as ugly source code.
|
|
21
21
|
|
|
22
|
+
## CLI Credential Sync (凭证同步)
|
|
23
|
+
|
|
24
|
+
Lansenger-CLI supports **multi-credential profiles** via the global `-P <profile>` flag. The profile name is the App ID. Before calling any CLI command, you must ensure the credential for the current appId is available in CLI's config store.
|
|
25
|
+
|
|
26
|
+
**Every CLI call MUST include `-P <appId>`** (placed immediately after `lansenger`, before the subcommand group) where `<appId>` is the Lansenger App ID from the current session's OpenClaw config. This ensures the CLI uses the correct bot credentials.
|
|
27
|
+
|
|
28
|
+
### Before first CLI call — sync credentials
|
|
29
|
+
|
|
30
|
+
Run this check-and-sync sequence **once** before your first CLI command in a session:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Step 1: Check if the profile already exists
|
|
34
|
+
lansenger -P <appId> config show
|
|
35
|
+
|
|
36
|
+
# Step 2: If the profile does NOT exist (returns error / "not configured"), write credentials from OpenClaw config:
|
|
37
|
+
lansenger -P <appId> config set app_id <appId>
|
|
38
|
+
lansenger -P <appId> config set app_secret <appSecret>
|
|
39
|
+
lansenger -P <appId> config set api_gateway_url <apiGatewayUrl>
|
|
40
|
+
lansenger -P <appId> config set passport_url <passportUrl> # optional
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The `<appId>`, `<appSecret>`, `<apiGatewayUrl>`, and `<passportUrl>` values come from the OpenClaw config:
|
|
44
|
+
- Single-account: `channels.lansenger.appId`, `channels.lansenger.appSecret`, `channels.lansenger.apiGatewayUrl`
|
|
45
|
+
- Multi-account: `channels.lansenger.accounts.<key>.appId`, `.appSecret`, `.apiGatewayUrl`
|
|
46
|
+
- Environment variables: `LANSENGER_APP_ID`, `LANSENGER_APP_SECRET`, `LANSENGER_API_GATEWAY_URL`
|
|
47
|
+
|
|
48
|
+
### Verify sync worked
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
lansenger -P <appId> config show
|
|
52
|
+
# Should show "Credentials configured: True"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### List all existing profiles
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
lansenger config list-profiles
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Manage profiles
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
lansenger config show # view current (default) profile
|
|
65
|
+
lansenger -P <appId> config show # view specific profile
|
|
66
|
+
lansenger -P <appId> config clear # delete specific profile
|
|
67
|
+
lansenger config clear --all # delete all profiles
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> **Tip**: After syncing once, the profile persists in `~/.lansenger/sdk_state.json`. You only need to sync again if credentials change or a new bot is added.
|
|
71
|
+
|
|
22
72
|
## Quick Decision: What Tool/Command Do I Use?
|
|
23
73
|
|
|
24
74
|
Need to send something? Follow this decision tree:
|
|
@@ -151,42 +201,44 @@ All tools accept optional `to` (chatId). Leave empty to auto-detect current conv
|
|
|
151
201
|
|
|
152
202
|
## CLI Command Reference
|
|
153
203
|
|
|
154
|
-
All commands use `lansenger
|
|
204
|
+
All commands use `lansenger <group> <subcommand>`. chatId is case-sensitive.
|
|
205
|
+
|
|
206
|
+
**Every CLI command MUST include `-P <appId>`** (global flag, placed after `lansenger` and before the subcommand) to select the correct credential profile. See [CLI Credential Sync](#cli-credential-sync-凭证同步) above for how to ensure the profile exists before calling.
|
|
155
207
|
|
|
156
208
|
### lansenger message send-text
|
|
157
209
|
|
|
158
210
|
```bash
|
|
159
|
-
lansenger message send-text <chat_id> <content> [--file <path>] [--mention-all] [--mention <uid1> [--mention <uid2>]]
|
|
211
|
+
lansenger -P <appId> message send-text <chat_id> <content> [--file <path>] [--mention-all] [--mention <uid1> [--mention <uid2>]]
|
|
160
212
|
```
|
|
161
213
|
|
|
162
214
|
### lansenger message send-markdown
|
|
163
215
|
|
|
164
216
|
```bash
|
|
165
|
-
lansenger message send-markdown <chat_id> <content> [--mention-all] [--mention <uid>]
|
|
217
|
+
lansenger -P <appId> message send-markdown <chat_id> <content> [--mention-all] [--mention <uid>]
|
|
166
218
|
```
|
|
167
219
|
|
|
168
220
|
### lansenger message send-file
|
|
169
221
|
|
|
170
222
|
```bash
|
|
171
|
-
lansenger message send-file <chat_id> <file_path> [--caption <text>] [--media-type <1|2|3>]
|
|
223
|
+
lansenger -P <appId> message send-file <chat_id> <file_path> [--caption <text>] [--media-type <1|2|3>]
|
|
172
224
|
```
|
|
173
225
|
|
|
174
226
|
### lansenger message send-image-url
|
|
175
227
|
|
|
176
228
|
```bash
|
|
177
|
-
lansenger message send-image-url <chat_id> <image_url> [--caption <text>]
|
|
229
|
+
lansenger -P <appId> message send-image-url <chat_id> <image_url> [--caption <text>]
|
|
178
230
|
```
|
|
179
231
|
|
|
180
232
|
### lansenger message send-link-card
|
|
181
233
|
|
|
182
234
|
```bash
|
|
183
|
-
lansenger message send-link-card <chat_id> <title> <link> [--desc <text>] [--icon <url>] [--pc-link <url>] [--from-name <name>] [--from-icon <url>]
|
|
235
|
+
lansenger -P <appId> message send-link-card <chat_id> <title> <link> [--desc <text>] [--icon <url>] [--pc-link <url>] [--from-name <name>] [--from-icon <url>]
|
|
184
236
|
```
|
|
185
237
|
|
|
186
238
|
### lansenger message send-app-articles
|
|
187
239
|
|
|
188
240
|
```bash
|
|
189
|
-
lansenger message send-app-articles <chat_id> '{"title":"T","url":"U","imgUrl":"I","summary":"S"}' '{"title":"T2","url":"U2"}'
|
|
241
|
+
lansenger -P <appId> message send-app-articles <chat_id> '{"title":"T","url":"U","imgUrl":"I","summary":"S"}' '{"title":"T2","url":"U2"}'
|
|
190
242
|
```
|
|
191
243
|
|
|
192
244
|
> ⚠️ Article field is `summary`, NOT `description`. `description` is silently ignored by the API.
|
|
@@ -194,7 +246,7 @@ lansenger message send-app-articles <chat_id> '{"title":"T","url":"U","imgUrl":"
|
|
|
194
246
|
### lansenger message send-app-card
|
|
195
247
|
|
|
196
248
|
```bash
|
|
197
|
-
lansenger message send-app-card <chat_id> <body_title> [--head-title <t>] [--sub-title <t>] [--content <t>] [--signature <t>] [--card-link <url>] [--dynamic] [--staff-id <id>] [--head-icon <url>] [--status-desc <div>] [--status-colour <hex>] [--field <json>] [--link <json>]
|
|
249
|
+
lansenger -P <appId> message send-app-card <chat_id> <body_title> [--head-title <t>] [--sub-title <t>] [--content <t>] [--signature <t>] [--card-link <url>] [--dynamic] [--staff-id <id>] [--head-icon <url>] [--status-desc <div>] [--status-colour <hex>] [--field <json>] [--link <json>]
|
|
198
250
|
```
|
|
199
251
|
|
|
200
252
|
**headStatusInfo**: `--status-desc` = status TEXT (supports div-style for text color), `--status-colour` = DOT/圆点 colour (hex). These are TWO different things: text color vs dot color.
|
|
@@ -202,19 +254,19 @@ lansenger message send-app-card <chat_id> <body_title> [--head-title <t>] [--sub
|
|
|
202
254
|
### lansenger message update-dynamic-card
|
|
203
255
|
|
|
204
256
|
```bash
|
|
205
|
-
lansenger message update-dynamic-card <msg_id> [--last] [--status-desc <div>] [--status-colour <hex>] [--link <json>]
|
|
257
|
+
lansenger -P <appId> message update-dynamic-card <msg_id> [--last] [--status-desc <div>] [--status-colour <hex>] [--link <json>]
|
|
206
258
|
```
|
|
207
259
|
|
|
208
260
|
### lansenger message revoke
|
|
209
261
|
|
|
210
262
|
```bash
|
|
211
|
-
lansenger message revoke <msg_id1> <msg_id2> [--chat-type bot|group] [--sender-id <id>]
|
|
263
|
+
lansenger -P <appId> message revoke <msg_id1> <msg_id2> [--chat-type bot|group] [--sender-id <id>]
|
|
212
264
|
```
|
|
213
265
|
|
|
214
266
|
### lansenger message query-groups
|
|
215
267
|
|
|
216
268
|
```bash
|
|
217
|
-
lansenger message query-groups [--page <n>] [--size <n>]
|
|
269
|
+
lansenger -P <appId> message query-groups [--page <n>] [--size <n>]
|
|
218
270
|
```
|
|
219
271
|
|
|
220
272
|
## Approval Workflow Pattern
|
|
@@ -225,8 +277,8 @@ lansenger message query-groups [--page <n>] [--size <n>]
|
|
|
225
277
|
|
|
226
278
|
**Via CLI:**
|
|
227
279
|
```bash
|
|
228
|
-
lansenger message send-app-card <chat_id> "审批" --dynamic --status-desc '<div style="color:#FFB116">待审批</div>' --status-colour "#FFB116"
|
|
229
|
-
lansenger message update-dynamic-card <msg_id> --last --status-desc '<div style="color:#198754">已批准</div>' --status-colour "#198754"
|
|
280
|
+
lansenger -P <appId> message send-app-card <chat_id> "审批" --dynamic --status-desc '<div style="color:#FFB116">待审批</div>' --status-colour "#FFB116"
|
|
281
|
+
lansenger -P <appId> message update-dynamic-card <msg_id> --last --status-desc '<div style="color:#198754">已批准</div>' --status-colour "#198754"
|
|
230
282
|
```
|
|
231
283
|
|
|
232
284
|
Status colors: #FFB116 (pending), #198754 (approved), #dc3545 (denied)
|
|
@@ -262,4 +314,6 @@ Status colors: #FFB116 (pending), #198754 (approved), #dc3545 (denied)
|
|
|
262
314
|
| headStatusInfo div wrapping | description supports div-style for color. colour is the DOT/圆点 color. Separate. |
|
|
263
315
|
| Message too long | ~4000 character limit. Split into multiple messages. |
|
|
264
316
|
| Tools not available | **Use CLI as fallback**: `pipx install lansenger-cli`, then `lansenger message send-text <chatId> <content>`. Agent tools may not inject in some Gateway versions. |
|
|
265
|
-
| CLI command not found | Install: `pipx install lansenger-cli` or `pip install lansenger-cli`. Then verify: `lansenger --help`. |
|
|
317
|
+
| CLI command not found | Install: `pipx install lansenger-cli` or `pip install lansenger-cli`. Then verify: `lansenger --help`. |
|
|
318
|
+
| CLI wrong credentials / sends as wrong bot | **Always use `-P <appId>`** (global flag after `lansenger`). Without it, CLI uses the `default` profile which may be a different bot. Sync first: `lansenger -P <appId> config show` → if missing, run `lansenger -P <appId> config set` commands. |
|
|
319
|
+
| CLI "Credentials configured: False" | Run credential sync: `lansenger -P <appId> config set app_id <appId>` + `lansenger -P <appId> config set app_secret <appSecret>`. |
|