@lansenger-pm/openclaw-lansenger-channel 3.0.1 → 3.0.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lansenger-pm/openclaw-lansenger-channel",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -1,227 +1,205 @@
1
1
  ---
2
2
  name: lansenger-messaging
3
- description: How to communicate on Lansenger (蓝信) — choose the right tool, when, send rich content, and pitfalls
3
+ description: How to communicate on Lansenger (蓝信) — choose the right tool, send rich content, approvals, and pitfalls
4
4
  metadata: {"openclaw":{"requires":{"config":["channels.lansenger"]},"primaryEnv":"LANSENGER_APP_ID"}}
5
5
  ---
6
6
 
7
7
  # Lansenger (蓝信) Messaging — Agent Quick Reference
8
8
 
9
- You are on Lansenger. This skill tells you **what tool to use, when, and how**.
9
+ In a Lansenger session, **just write your reply normally** — Markdown renders automatically as formatText. No tool needed for formatted text unless you also need @mentions.
10
10
 
11
- > ⚠️ This is reference documentation, NOT a CLI command. `openclaw skill lansenger-messaging` does not exist. Use the agent tools listed below directly.
11
+ However, Markdown and file attachments are **mutually exclusive**. If you need both formatting AND a file, send the Markdown reply first, then call `lansenger_send_file` separately.
12
12
 
13
- ---
14
-
15
- ## Quick Decision: What Tool Do I Use?
16
- ```
17
- Need to send something? Follow this decision tree:
13
+ **Never put raw Markdown in lansenger_send_text** — it displays as ugly source code.
18
14
 
19
- 1. Normal reply with formatting (bold, lists, code, tables) JUST WRITE IT. Markdown renders automatically. No tool needed.
20
- 2. Need Markdown + @mention someone → lansenger_send_format_text (with reminder)
21
- 3. Need plain text + @mention + file → lansenger_send_text (with reminder + filePath)
22
- 4. Need just a FILE (any local file) → lansenger_send_file
23
- 5. Need image from URL → lansenger_send_image_url
24
- 6. Need a link card → lansenger_send_link_card
25
- 7. Need multi-article card (图文) → lansenger_send_app_articles
26
- 8. Need a rich formatted card → lansenger_send_app_card
27
- 9. Need approval workflow → lansenger_send_app_card (isDynamic=true) → update via lansenger_update_dynamic_card
28
- 10. Need to revoke a message → lansenger_revoke_message
29
- 11. Need group IDs → lansenger_query_groups
30
- ```
31
- > ⚠️ Group chat: appCard/linkCard/appArticles/formatText may be rejected by API. Fall back to lansenger_send_text.
32
- ```
33
- ---
15
+ > ⚠️ This is reference documentation, NOT a CLI command. `openclaw skill lansenger-messaging` does not exist. Use the agent tools directly.
34
16
 
35
- ## #1 Rule: Markdown Is Automatic
36
- In a Lansenger session, **just write your reply normally** — Markdown is automatically rendered as formatText. You never need to call a tool for formatted text unless you also need @mentions.
17
+ ## Quick Decision: What Tool Do I Use?
37
18
 
38
- However: Markdown and file attachments are **mutually exclusive**. If you need both formatting AND a file, send the Markdown reply first, then call `lansenger_send_file separately.
39
- Never put raw Markdown in lansenger_send_text — it displays as ugly source code.
19
+ Need to send something? Follow this decision tree:
40
20
 
41
- ---
21
+ 1. Normal reply with formatting → JUST WRITE IT. No tool needed.
22
+ 2. Markdown + @mention → lansenger_send_format_text (with reminder)
23
+ 3. Plain text + @mention + file → lansenger_send_text (with reminder + filePath)
24
+ 4. Send a FILE → lansenger_send_file
25
+ 5. Send image from URL → lansenger_send_image_url
26
+ 6. Link card → lansenger_send_link_card
27
+ 7. Multi-article card (图文) → lansenger_send_app_articles
28
+ 8. Rich formatted card → lansenger_send_app_card
29
+ 9. Approval workflow → sendAppCard(isDynamic=true) → updateDynamicCard
30
+ 10. Revoke a message → lansenger_revoke_message
31
+ 11. Find group IDs → lansenger_query_groups
42
32
 
43
33
  ## Message Type Capability Matrix
44
- ```
45
- ┌──────────────┬──────────────┬──────────────┬──────────────┐
46
- │ Type │ Markdown │ @mention │ Attachments │
47
- ├──────────────┼──────────────┼──────────────┼──────────────┤
48
- │ formatText │ ✓ (auto) │ ✓ (reminder)│ ✗ │
49
- │ text │ ✗ │ ✓ │ ✓ │
50
- └──────────────┴──────────────┴──────────────┴──────────────┘
51
- ```
52
- - formatText: default outbound type. Markdown renders automatically. Also supports @mentions via `reminder` param (auto-fallback if API rejects). No file attachments.
53
- - text: plain text only. Supports @mentions + file attachments. No Markdown rendering.
54
34
 
35
+ | Type | Markdown | @mention | Attachments |
36
+ |------------|----------|---------------|-------------|
37
+ | formatText | ✓ (auto) | ✓ (reminder) | ✗ |
38
+ | text | ✗ | ✓ | ✓ |
39
+
40
+ - **formatText**: Markdown renders, supports @mention via reminder param (auto-fallback if API rejects). No file attachments.
41
+ - **text**: Plain text only. Supports @mention + file attachment. No Markdown rendering.
55
42
  - These two types are **mutually exclusive** — pick one based on what you need.
56
- ```
57
- ---
58
43
 
59
44
  ## Tool Reference
60
- All tools accept optional `to` (chatId). Leave empty to auto-detect current conversation. Only fill for different chat. chatId is case-sensitive.
61
- ```
62
- How to get chatId: Inbound message senderId/conversationId. Never truncate or modify a chatId.
63
45
 
64
- ```
65
- ---
46
+ All tools accept optional `to` (chatId). Leave empty to auto-detect current conversation. Only fill for different chat. chatId is case-sensitive — never truncate or modify.
66
47
 
67
48
  ### lansenger_send_file
68
- | Param | Required | Description |
69
- |-------|----------|-------------|
70
- | filePath | ✅ | Absolute local path (workspace, /tmp, Desktop, etc.) |
71
- | caption | | Plain-text caption (no Markdown) |
72
- | to | ❌ | Target chatId (auto if omitted) |
73
- > Use this instead of MEDIA: tags for non-workspace files. MEDIA: silently fails outside workspace.
49
+
50
+ | Param | Type | Required | Description |
51
+ |----------------|----------|----------|----------------------------------------------------|
52
+ | filePath | string | | Absolute local path (workspace, /tmp, Desktop, etc.) |
53
+ | caption | string | ❌ | Plain-text caption (no Markdown) |
54
+ | to | string | ❌ | Target chatId (auto if omitted) |
55
+
56
+ > ⚠️ **MEDIA: tags currently broken** — they silently fail for ALL files, not just workspace ones. Use `lansenger_send_file` for every file attachment.
74
57
 
75
58
  ### lansenger_send_text
76
- | Param | Required | Description |
77
- |-------|----------|-------------|
78
- | content | ✅ | Plain text only (NO Markdown) |
79
- | filePath | | Optional file to attach (content becomes caption) |
80
- | to | ❌ | Target chatId |
81
- | reminderAll | ❌ | @mention all members (group only) |
82
- | reminderUserIds | ❌ | @mention specific users (group only) |
59
+
60
+ | Param | Type | Required | Description |
61
+ |----------------|----------|----------|----------------------------------------------------|
62
+ | content | string | | Plain text only (NO Markdown) |
63
+ | filePath | string | ❌ | Optional file to attach (content becomes caption) |
64
+ | to | string | ❌ | Target chatId |
65
+ | reminderAll | boolean | ❌ | @mention all members (group only) |
66
+ | reminderUserIds | string[] | ❌ | @mention specific users (group only) |
83
67
 
84
68
  ### lansenger_send_format_text
85
- | Param | Required | Description |
86
- |-------|----------|-------------|
87
- | content | ✅ | Markdown text |
88
- | to | ❌ | Target chatId |
89
- | reminderAll | ❌ | @mention all (group only) |
90
- | reminderUserIds | ❌ | @mention specific users (group only) |
91
69
 
92
- > Use when you need Markdown + @mention. No file attachments. Plugin auto-fallback if API rejects reminder.
70
+ | Param | Type | Required | Description |
71
+ |----------------|----------|----------|----------------------------------------------------|
72
+ | content | string | ✅ | Markdown text |
73
+ | to | string | ❌ | Target chatId |
74
+ | reminderAll | boolean | ❌ | @mention all (group only) |
75
+ | reminderUserIds | string[] | ❌ | @mention specific users (group only) |
93
76
 
94
- Always include "@姓名" in text when mentioning someone.
77
+ > Use when you need Markdown + @mention. No file attachments. Plugin auto-fallback if API rejects reminder.
95
78
 
96
79
  ### lansenger_send_image_url
97
- | Param | Required | Description |
98
- |-------|----------|-------------|
99
- | imageUrl | ✅ | Directly reachable image URL |
100
- | caption | ❌ | Plain-text caption (no Markdown) |
101
- | to | ❌ | Target chatId |
102
80
 
103
- > URL must be reachable from gateway host. For local files use lansenger_send_file.
81
+ | Param | Type | Required | Description |
82
+ |----------|----------|----------|----------------------------------------------------|
83
+ | imageUrl | string | ✅ | Directly reachable image URL |
84
+ | caption | string | ❌ | Plain-text caption (no Markdown) |
85
+ | to | string | ❌ | Target chatId |
86
+
87
+ > URL must be reachable from the gateway host. For local files, use `lansenger_send_file`.
104
88
 
105
89
  ### lansenger_send_link_card
106
- | Param | Required | Description |
107
- |-------|----------|-------------|
108
- | title | ✅ | Card title |
109
- | link | ✅ | Click-through URL |
110
- | description | | Card description (API-required, defaults empty) |
111
- | iconLink | ❌ | Icon URL (defaults empty) |
112
- | fromName | ❌ | Source name (defaults empty) |
113
- | fromIconLink | ❌ | Source icon URL (defaults empty) |
114
- | to | ❌ | Target chatId |
90
+
91
+ | Param | Type | Required | Description |
92
+ |--------------|--------|----------|----------------------------------------------------|
93
+ | title | string | ✅ | Card title |
94
+ | link | string | ✅ | Click-through URL |
95
+ | description | string | ❌ | Card description (API-required, defaults empty) |
96
+ | iconLink | string | ❌ | Icon URL (defaults empty) |
97
+ | pcLink | string | ❌ | PC client link |
98
+ | fromName | string | ❌ | Source name (defaults empty) |
99
+ | fromIconLink | string | ❌ | Source icon URL (defaults empty) |
100
+ | to | string | ❌ | Target chatId |
115
101
 
116
102
  ### lansenger_send_app_articles
117
- | Param | Required | Description |
118
- |-------|----------|-------------|
119
- | articles | ✅ | Each: { imgUrl, title, url, summary? } |
120
- | to | ❌ | Target chatId |
121
103
 
122
- > ⚠️ Article summary field is `summary`, NOT `description`. `description` is silently ignored.
104
+ | Param | Type | Required | Description |
105
+ |----------|----------|----------|----------------------------------------------------|
106
+ | articles | object[] | ✅ | Each: { imgUrl, title, url, summary?, pcUrl? } |
107
+ | to | string | ❌ | Target chatId |
108
+
109
+ > ⚠️ Article summary field is `summary`, NOT `description`. `description` is silently ignored by the API.
123
110
 
124
111
  ### lansenger_send_app_card
125
- | Param | Required | Description |
126
- |-------|----------|-------------|
127
- | bodyTitle | ✅ | Card title (supports div-style) |
128
- | headTitle | ❌ | Header title |
129
- | bodyContent | ❌ | Content (supports div-style) |
130
- | isDynamic | ❌ | Enable approval workflow (default: false) |
131
- | headStatusInfo | ❌ | { description, colour } — description is status TEXT (supports div-style for color, e.g. `<div style="color:#FFB116">待审批</div>`, max 30 bytes), colour is the DOT/圆点 color (hex, e.g. #FFB116). These are TWO different things: text color vs dot color. |
132
- | fields | ❌ | Key-value pairs (max 10) |
133
- | links | ❌ | Links (max 3) |
134
- | to | ❌ | Target chatId |
135
-
136
- > ⚠️ **Group chat does NOT support appCard** — falls back to plain text. Approval workflows won't work in group chat.
137
-
138
- ```
139
- ---
140
112
 
141
- div-style formatting rules:
113
+ | Param | Type | Required | Description |
114
+ |----------------|----------|----------|----------------------------------------------------|
115
+ | bodyTitle | string | ✅ | Card title (supports div-style) |
116
+ | headTitle | string | ❌ | Header title |
117
+ | bodySubTitle | string | ❌ | Subtitle (supports div-style) |
118
+ | bodyContent | string | ❌ | Main content (supports div-style) |
119
+ | signature | string | ❌ | Footer signature |
120
+ | isDynamic | boolean | ❌ | Enable approval workflow (default: false) |
121
+ | headStatusInfo | object | ❌ | { description, colour } — description: status TEXT (supports div-style for color, e.g. `<div style="color:#FFB116">待审批</div>`, max 30 bytes). colour: DOT/圆点 color (hex, e.g. #FFB116). These are TWO different things: text color vs dot color. |
122
+ | fields | object[] | ❌ | Key-value pairs (max 10) |
123
+ | links | object[] | ❌ | Links (max 3): { title, url } |
124
+ | cardLink | string | ❌ | Card click-through link |
125
+ | staffId | string | ❌ | Staff openId for sender avatar |
126
+ | headIconUrl | string | ❌ | Header icon URL |
127
+ | to | string | ❌ | Target chatId |
128
+
129
+ **div-style rules:**
142
130
  - `color`: hex (e.g. #333, #007BFF)
143
131
  - `font-size`: **MUST use pt** (12pt–36pt). px causes "invalid bodyContent" error.
144
132
  - `text-align`: left, center, right
145
133
  - `text-indent`: **MUST use 0em** — bare 0 causes silent failure
146
- ```
147
134
 
148
135
  Example: `<div style="color:#333;font-size:14pt;text-indent:0em;text-align:left">Content here</div>`
149
- ```
150
- ---
151
136
 
152
137
  ### lansenger_update_dynamic_card
153
- | Param | Required | Description |
154
- |-------|----------|-------------|
155
- | msgId | ✅ | Message ID from original send_app_card response |
156
- | headStatusInfo | ❌ | { description, colour } — description is text (supports div-style for color; `<div style="color:#198754">已批准</div>`), max 30 bytes. colour is the DOT/圆点 color (hex like #198754). These are TWO different things: text color vs dot color. |
157
- | isLastUpdate | ❌ | True = final state (default: false) |
158
138
 
159
- > headStatusInfo.description supports div-style for coloring the text. headStatusInfo.colour controls the status dot color. They are independent.
139
+ | Param | Type | Required | Description |
140
+ |----------------|----------|----------|----------------------------------------------------|
141
+ | msgId | string | ✅ | Message ID from original send_app_card response |
142
+ | headStatusInfo | object | ❌ | { description, colour } — description: status TEXT (supports div-style for color). colour: DOT/圆点 color (hex). Independent. |
143
+ | links | object[] | ❌ | Updated links (max 3) |
144
+ | isLastUpdate | boolean | ❌ | True = final state, card becomes static (default: false) |
145
+
146
+ > Set `isLastUpdate=true` on final approval decision. Intermediate updates: keep `isLastUpdate=false` (default).
160
147
 
161
148
  ### lansenger_revoke_message
162
- | Param | Required | Description |
163
- |-------|----------|-------------|
164
- | messageIds | ✅ | List of message IDs |
165
- | chatType | | bot (default) or group |
166
- | senderId | ❌ | Required if chatType=group |
149
+
150
+ | Param | Type | Required | Description |
151
+ |-----------|----------|----------|----------------------------------------------------|
152
+ | messageIds | string[] | ✅ | List of message IDs to revoke |
153
+ | chatType | string | ❌ | bot (default) or group |
154
+ | senderId | string | ❌ | Required if chatType=group |
167
155
 
168
156
  ### lansenger_query_groups
169
- | Param | Required | Description |
170
- |-------|----------|-------------|
171
- | pageOffset | ❌ | Page number (default: 1) |
172
- | pageSize | ❌ | Groups per page (default: 100) |
173
157
 
174
- > ⚠️ May return errCode=10005 "API服务无权限" on enterprise deployments. Ask user for group IDs manually.
158
+ | Param | Type | Required | Description |
159
+ |------------|---------|----------|----------------------------------------------------|
160
+ | pageOffset | integer | ❌ | Page number (default: 1) |
161
+ | pageSize | integer | ❌ | Groups per page (default: 100) |
175
162
 
176
- ---
163
+ > ⚠️ May return errCode=10005 "API服务无权限" on enterprise deployments. Ask user for group IDs manually.
177
164
 
178
165
  ## Approval Workflow Pattern
179
- ```
180
- 1. Send: lansenger_send_app_card(bodyTitle="...", isDynamic=true, headStatusInfo={description: '<div style="color:#FFB116">待审批</div>', colour: "#FFB116"})
181
- 2. User approves/denies → OpenClaw processes approval
182
- 3. Update: lansenger_update_dynamic_card(msgId="<from step 1>", headStatusInfo={description: '<div style="color:#198754">已批准</div>', colour: "#198754"}, isLastUpdate=true)
183
- ```
184
- Status colors: #FFB116 (pending), #198754 (approved) #dc3545 (denied)
185
166
 
186
- ⚠️ **Approval only works in DM (1:1 chat)** — group chat de appCard falls back to plain text.
167
+ 1. Send: `lansenger_send_app_card(bodyTitle="...", isDynamic=true, headStatusInfo={description: '<div style="color:#FFB116">待审批</div>', colour: "#FFB116"})`
168
+ 2. User approves/denies → OpenClaw processes approval
169
+ 3. Update: `lansenger_update_dynamic_card(msgId="<from step 1>", headStatusInfo={description: '<div style="color:#198754">已批准</div>', colour: "#198754"}, isLastUpdate=true)`
187
170
 
188
- ```
189
- ---
171
+ Status colors: #FFB116 (pending), #198754 (approved), #dc3545 (denied)
190
172
 
191
173
  ## @Mention Rules
192
- Both formatText and text support @mentions:
193
- - formatText: `reminderAll` + `reminderUserIds` params
194
- - text: `reminderAll` + `reminderUserIds` params
195
174
 
196
- Two rules:
197
- 1. Always include "@姓名" in message text — reminder sends the push, "@姓名" makes it visible
198
- 2. reminder is optional — use it in group chat when replying to someone so they notice your message
175
+ Both `lansenger_send_format_text` and `lansenger_send_text` support @mentions via `reminderAll` + `reminderUserIds` params.
199
176
 
200
- ---
177
+ 1. **Always include "@姓名" in message text** — reminder sends the push notification, "@姓名" makes it visible in the message itself. This is especially important in **group chat** — without "@姓名" the mentioned person won't see who is being addressed.
178
+ 2. **reminder is optional** — use it when you want someone to receive a push notification about your message.
201
179
 
202
180
  ## Inbound Messages
203
- | Type | What you see |
204
- |------|-------------|
205
- | text | Plain text |
206
- | formatText | Markdown text |
207
- | image | [Image] + local file paths |
208
- | video | [Video] + local file paths |
209
- | file | [File] + local file paths |
210
- | voice | [Voice] + local file path |
211
- | position | [Location] name address lat,long |
212
- | card | [Contact Card] staffId |
213
181
 
214
- ---
182
+ | Type | What you see |
183
+ |------------|---------------------------------------------------|
184
+ | text | Plain text content |
185
+ | formatText | Markdown text content |
186
+ | image | [Image] + local file paths |
187
+ | video | [Video] + local file paths |
188
+ | file | [File] + local file paths |
189
+ | voice | [Voice] + local file path |
190
+ | position | [Location] name address lat,long |
191
+ | card | [Contact Card] staffId |
192
+ | sticker | [Sticker] stickerId |
215
193
 
216
194
  ## Common Pitfalls
217
- | Pitfall | Fix |
218
- |---------|-----|
219
- | Raw Markdown in text tool | Never do this — shows as ugly source code. Write normally for Markdown. |
220
- | MEDIA: tag for non-workspace file | Use lansenger_send_file. MEDIA: silently fails outside workspace. |
221
- | AppArticles `description` field | Use `summary`, not `description`. `description` is ignored. |
222
- | AppCard `font-size: 14px` | Use `font-size: 14pt`. px causes "invalid bodyContent". Range: 12pt–36pt. |
223
- | AppCard `text-indent: 0` | Use `text-indent: 0em`. Bare 0 causes silent failure. |
224
- | Dynamic card headStatusInfo div wrapping │ description SUPPORTS div-style for color. colour is for the dot/圆点 only. They are separate. |
225
- | Group chat appCard | Falls back to plain text. Approval workflows won't work. Use text + /approve. |
226
- | Message too long | ~4000 character limit. Split long content into multiple messages. |
227
- | `openclaw skill` command | Does NOT exist. Use agent tools directly. |
195
+
196
+ | Pitfall | Fix |
197
+ |--------------------------------|----------------------------------------------------------------------------------|
198
+ | Raw Markdown in text tool | Never do this shows as ugly source code. Write normally for Markdown. |
199
+ | MEDIA: tag for file delivery | ⚠️ Currently broken for ALL files. Use `lansenger_send_file` instead. |
200
+ | AppArticles `description` field | Use `summary`, not `description`. `description` is silently ignored by the API. |
201
+ | AppCard `font-size: px` | Use `pt` units (12pt–36pt). px causes API "invalid bodyContent" error. |
202
+ | AppCard `text-indent: 0` | Use `0em` with unit. Bare 0 causes silent failure. |
203
+ | headStatusInfo div wrapping | description supports div-style for color. colour is the DOT/圆点 color. Separate. |
204
+ | Message too long | ~4000 character limit. Split into multiple messages. |
205
+ | `openclaw skill` command | Does NOT exist. Use agent tools directly. |