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