@invago/mixin 1.0.10 → 1.0.11

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/README.md CHANGED
@@ -2,683 +2,694 @@
2
2
 
3
3
  Connect [Mixin Messenger](https://mixin.one/messenger) to [OpenClaw](https://openclaw.ai).
4
4
 
5
- **[Chinese Documentation](README.zh-CN.md)**
6
-
7
- ## Overview
8
-
9
- MixinClaw is an OpenClaw channel plugin. It runs in the same process as the OpenClaw Gateway, receives inbound messages from Mixin Blaze WebSocket, and delivers outbound messages over the Mixin HTTP API.
10
-
11
- Important:
12
-
13
- - Install the plugin on the same machine where the OpenClaw Gateway runs.
14
- - OpenClaw config files use JSON5, so comments and trailing commas are allowed.
15
- - The proxy configured by this plugin only affects this plugin.
16
-
17
- ## Recommended Install
18
-
19
- Use the OpenClaw plugin installer:
20
-
21
- ```bash
22
- openclaw plugins install @invago/mixin
23
- ```
24
-
25
- `@invago/mixin` is the published npm package name. The OpenClaw runtime/plugin name remains `mixin`.
26
-
27
- If the plugin is already installed, upgrade it with the plugin id:
28
-
29
- ```bash
30
- openclaw plugins update mixin
31
- ```
32
-
33
- To install a specific version for the first time:
34
-
35
- ```bash
36
- openclaw plugins install @invago/mixin@<version>
37
- ```
38
-
39
- Then confirm the plugin is installed:
40
-
41
- ```bash
42
- openclaw plugins list
43
- openclaw plugins info mixin
44
- ```
45
-
46
- ## Local Development Install
47
-
48
- If you are developing locally, clone the repository and install dependencies:
49
-
50
- ```bash
51
- git clone https://github.com/invago/mixinclaw.git
52
- cd mixinclaw
53
- npm install
54
- ```
55
-
56
- Then install it into OpenClaw from the local path:
57
-
58
- ```bash
59
- openclaw plugins install .
60
- ```
61
-
62
- ## Create a Mixin Bot
63
-
64
- Go to [Mixin Developers Dashboard](https://developers.mixin.one/dashboard), create a bot, and collect:
65
-
66
- - `appId`
67
- - `sessionId`
68
- - `serverPublicKey`
69
- - `sessionPrivateKey`
70
-
71
- ## Configuration
72
-
73
- Edit your `openclaw.json` file manually and add both the channel configuration and the plugin enablement block:
74
-
75
- ```json
76
- {
77
- "channels": {
78
- "mixin": {
79
- "defaultAccount": "default",
80
- "appId": "YOUR_APP_ID",
81
- "sessionId": "YOUR_SESSION_ID",
82
- "serverPublicKey": "YOUR_SERVER_PUBLIC_KEY_BASE64",
83
- "sessionPrivateKey": "YOUR_SESSION_PRIVATE_KEY_BASE64",
84
- "dmPolicy": "pairing",
85
- "allowFrom": ["AUTHORIZED_USER_UUID"],
86
- "requireMentionInGroup": true,
87
- "mediaBypassMentionInGroup": true,
88
- "mediaMaxMb": 30,
89
- "audioSendAsVoiceByDefault": true,
90
- "audioAutoDetectDuration": true,
91
- "audioRequireFfprobe": false,
92
- "mixpay": {
93
- "enabled": true,
94
- "payeeId": "YOUR_MIXPAY_PAYEE_ID",
95
- "defaultSettlementAssetId": "YOUR_SETTLEMENT_ASSET_ID",
96
- "expireMinutes": 15,
97
- "pollIntervalSec": 30,
98
- "allowedCreators": ["AUTHORIZED_USER_UUID"],
99
- "notifyOnPending": false,
100
- "notifyOnPaidLess": true
101
- },
102
- "proxy": {
103
- "enabled": true,
104
- "url": "socks5://127.0.0.1:10808",
105
- "username": "proxy-user",
106
- "password": "proxy-pass"
107
- }
108
- }
109
- },
110
- "plugins": {
111
- "allow": ["mixin"],
112
- "entries": {
113
- "mixin": {
114
- "enabled": true
115
- }
116
- }
117
- }
118
- }
119
- ```
120
-
121
- Notes:
122
-
123
- - `channels.mixin` configures the channel itself.
124
- - `plugins.allow` and `plugins.entries.mixin.enabled` are also required so OpenClaw loads this plugin.
125
- - Mixin supports the standard OpenClaw direct-message policies. The recommended setting is `dmPolicy: "pairing"`.
126
- - `allowFrom` remains useful for pre-authorized users or manual overrides. Pairing approvals are stored in OpenClaw's pairing allowlist store.
127
- - If `proxy.url` already contains credentials, `proxy.username` and `proxy.password` can be omitted.
128
-
129
- ## Pairing
130
-
131
- For private chats, the recommended mode is:
132
-
133
- ```json
134
- {
135
- "channels": {
136
- "mixin": {
137
- "dmPolicy": "pairing"
138
- }
139
- }
140
- }
141
- ```
142
-
143
- Behavior:
144
-
145
- - A new, unauthorized Mixin user gets an 8-character pairing code in the DM.
146
- - Approve that user with `openclaw pairing approve mixin <code>`.
147
- - Use `openclaw pairing list mixin` to inspect pending pairing requests.
148
- - Once approved, the user is added to OpenClaw's pairing allowlist store for the `mixin` channel.
149
- - `allowFrom` is still honored and can be used alongside pairing for users you want to pre-authorize.
150
-
151
- ## Avoid Cross-Channel Session Mixing
152
-
153
- Mixin group chats already stay isolated by channel, but direct-message sessions follow the OpenClaw `session.dmScope` policy. If you keep the default `main` scope, Mixin direct messages can share the same main session with other channels such as Feishu.
154
-
155
- Recommended configuration:
156
-
157
- ```json
158
- {
159
- "session": {
160
- "dmScope": "per-channel-peer"
161
- }
162
- }
163
- ```
164
-
165
- Use `per-account-channel-peer` instead if you run multiple Mixin accounts and want direct-message sessions isolated by both channel and account.
166
-
167
- ## Multi-Agent Routing Per Bot Account
168
-
169
- OpenClaw supports routing different channel accounts to different agents through `bindings[].match.accountId`.
170
-
171
- Recommended pattern:
172
-
173
- - One Mixin bot account = one `accountId`
174
- - One `accountId` = one agent binding
175
- - Keep session isolation at `per-account-channel-peer` when you run multiple bot accounts
176
-
177
- Example:
178
-
179
- ```json
180
- {
181
- "session": {
182
- "dmScope": "per-account-channel-peer"
183
- },
184
- "agents": {
185
- "list": [
186
- {
187
- "id": "main",
188
- "workspace": "E:/AI/workspace-main",
189
- "default": true
190
- },
191
- {
192
- "id": "sales",
193
- "workspace": "E:/AI/workspace-sales"
194
- },
195
- {
196
- "id": "support",
197
- "workspace": "E:/AI/workspace-support"
198
- }
199
- ]
200
- },
201
- "bindings": [
202
- {
203
- "agentId": "main",
204
- "match": {
205
- "channel": "mixin",
206
- "accountId": "default"
207
- }
208
- },
209
- {
210
- "agentId": "sales",
211
- "match": {
212
- "channel": "mixin",
213
- "accountId": "sales"
214
- }
215
- },
216
- {
217
- "agentId": "support",
218
- "match": {
219
- "channel": "mixin",
220
- "accountId": "support"
221
- }
222
- }
223
- ],
224
- "channels": {
225
- "mixin": {
226
- "defaultAccount": "default",
227
- "accounts": {
228
- "default": {
229
- "name": "Main Bot",
230
- "appId": "APP_ID_1",
231
- "sessionId": "SESSION_ID_1",
232
- "serverPublicKey": "SERVER_PUBLIC_KEY_1",
233
- "sessionPrivateKey": "SESSION_PRIVATE_KEY_1"
234
- },
235
- "sales": {
236
- "name": "Sales Bot",
237
- "appId": "APP_ID_2",
238
- "sessionId": "SESSION_ID_2",
239
- "serverPublicKey": "SERVER_PUBLIC_KEY_2",
240
- "sessionPrivateKey": "SESSION_PRIVATE_KEY_2"
241
- },
242
- "support": {
243
- "name": "Support Bot",
244
- "appId": "APP_ID_3",
245
- "sessionId": "SESSION_ID_3",
246
- "serverPublicKey": "SERVER_PUBLIC_KEY_3",
247
- "sessionPrivateKey": "SESSION_PRIVATE_KEY_3"
248
- }
249
- }
250
- }
251
- }
252
- }
253
- ```
254
-
255
- Notes:
256
-
257
- - `match.accountId` binds one Mixin bot account to one agent.
258
- - If `accountId` is omitted in a binding, OpenClaw treats it as the default account only.
259
- - Use `accountId: "*"` only when you want one fallback agent for all Mixin accounts.
260
- - If you need one specific group or DM to override the account-level routing, add a more specific `match.peer` binding. Peer matches win over `accountId` matches.
261
-
262
- ## Configuration Reference
263
-
264
- | Parameter | Required | Default | Description |
265
- |-----------|----------|---------|-------------|
266
- | `defaultAccount` | No | `default` | Default account ID used when `accounts` is configured |
267
- | `appId` | Yes | - | Mixin App UUID |
268
- | `sessionId` | Yes | - | Session UUID |
269
- | `serverPublicKey` | Yes | - | Server Public Key (Base64) |
270
- | `sessionPrivateKey` | Yes | - | Session Private Key (Ed25519 Base64) |
271
- | `dmPolicy` | No | `pairing` | Direct-message policy: `pairing`, `allowlist`, `open`, or `disabled` |
272
- | `allowFrom` | No | `[]` | Authorized user UUID whitelist |
273
- | `groupPolicy` | No | OpenClaw default | Group-message policy: `open`, `allowlist`, or `disabled` |
274
- | `groupAllowFrom` | No | `[]` | Authorized sender UUID whitelist for group messages when `groupPolicy` uses allowlisting |
275
- | `requireMentionInGroup` | No | `true` | Apply plugin-side trigger-word filtering to group messages that have already been delivered to the bot |
276
- | `mediaBypassMentionInGroup` | No | `true` | Allow inbound group file/audio messages through even without trigger text |
277
- | `mediaMaxMb` | No | `30` | Max inbound and outbound media size in MB |
278
- | `audioSendAsVoiceByDefault` | No | `true` | Send OpenClaw native outbound audio as Mixin voice when possible |
279
- | `audioAutoDetectDuration` | No | `true` | Detect native outbound audio duration with `ffprobe` before sending voice |
280
- | `audioRequireFfprobe` | No | `false` | Fail native outbound audio instead of falling back to file when duration detection is unavailable |
281
- | `mixpay.enabled` | No | `false` | Enable MixPay collect support for this Mixin account |
282
- | `mixpay.payeeId` | Required when enabled | - | MixPay merchant/payee ID used to create one-time payment orders |
283
- | `mixpay.defaultQuoteAssetId` | No | - | Default quote asset ID for collect templates or future collect commands |
284
- | `mixpay.defaultSettlementAssetId` | No | - | Default settlement asset ID for MixPay orders |
285
- | `mixpay.expireMinutes` | No | `15` | Default MixPay order expiration time in minutes |
286
- | `mixpay.pollIntervalSec` | No | `30` | Poll interval in seconds for pending MixPay orders |
287
- | `mixpay.allowedCreators` | No | `[]` | Optional sender UUID allowlist for creating MixPay collect orders |
288
- | `mixpay.notifyOnPending` | No | `false` | Notify the chat when MixPay reports `pending` |
289
- | `mixpay.notifyOnPaidLess` | No | `true` | Notify the chat when MixPay indicates an underpayment |
290
- | `conversations.<conversationId>.enabled` | No | `true` | Enable or disable a specific group conversation |
291
- | `conversations.<conversationId>.requireMention` | No | Inherit account | Override group trigger-word requirement for a specific conversation |
292
- | `conversations.<conversationId>.allowFrom` | No | Inherit account | Override group sender allowlist for a specific conversation |
293
- | `conversations.<conversationId>.mediaBypassMention` | No | Inherit account | Override whether file/audio messages bypass mention filtering |
294
- | `conversations.<conversationId>.groupPolicy` | No | Inherit account | Override group policy for a specific conversation |
295
- | `debug` | No | `false` | Debug mode |
296
- | `proxy.enabled` | No | `false` | Enable per-plugin proxy |
297
- | `proxy.url` | Required when enabled | - | Proxy URL such as `http://127.0.0.1:7890` or `socks5://127.0.0.1:10808` |
298
- | `proxy.username` | No | - | Proxy username |
299
- | `proxy.password` | No | - | Proxy password |
300
-
301
- ## Proxy
302
-
303
- - Both Mixin HTTP requests and Blaze WebSocket traffic use the same proxy.
304
- - Supported proxy URL styles depend on the underlying proxy agent stack; typical values are `http://...`, `https://...`, and `socks5://...`.
305
- - You must provide your own proxy software or proxy server. The plugin only consumes a proxy, it does not create one.
306
-
307
- ## Group Access Control
308
-
309
- Mixin now supports formal group access controls in addition to direct-message `dmPolicy`.
310
-
311
- - `groupPolicy: "open"` allows any sender in a group conversation.
312
- - `groupPolicy: "allowlist"` requires the sender UUID to appear in `groupAllowFrom`.
313
- - `groupPolicy: "disabled"` blocks the entire conversation.
314
- - `conversations.<conversationId>` overrides account-level group settings for that single conversation.
315
-
316
- Important delivery boundary:
317
-
318
- - In practice, Mixin group bots reliably receive messages when the bot is explicitly mentioned.
319
- - `requireMentionInGroup: false` only disables this plugin's own post-delivery filtering.
320
- - It does not guarantee that Mixin will deliver every non-mention group message to the bot.
321
- - If a non-mention group message produces no read receipt and no inbound log, the message most likely was not delivered to the plugin by Mixin in the first place.
322
-
323
- Example:
324
-
325
- ```json
326
- {
327
- "channels": {
328
- "mixin": {
329
- "groupPolicy": "allowlist",
330
- "groupAllowFrom": ["USER_A_UUID"],
331
- "conversations": {
332
- "70000000-0000-0000-0000-000000000001": {
333
- "requireMention": false,
334
- "allowFrom": ["USER_B_UUID"],
335
- "mediaBypassMention": false
336
- },
337
- "70000000-0000-0000-0000-000000000002": {
338
- "enabled": false
339
- }
340
- }
341
- }
342
- }
343
- }
344
- ```
345
-
346
- How to get these values:
347
-
348
- - `conversations.<conversationId>`: use the group's `conversation_id`. In practice, the easiest way is to let the group send a message to the bot once, then read the `conversationId` from the plugin logs or inbound event context. Mixin's conversation APIs also use the same `conversation_id` field for group conversations.
349
- - `groupAllowFrom` or `conversations.<conversationId>.allowFrom`: use the sender's Mixin `user_id` UUID. Mixin user IDs can be learned when the user messages the bot, adds the bot as a contact, or authorizes the application.
350
- - If you manage the group through Mixin APIs, the returned conversation payload also includes group participants with their `user_id` fields.
351
-
352
- Recommended operational approach:
353
-
354
- - Let the target group send one message to the bot
355
- - Copy the logged `conversationId`
356
- - Let the target member send one message, then copy that sender's `user_id`
357
- - Put those values into `conversations.<conversationId>` and `groupAllowFrom` / `allowFrom`
358
-
359
- Pairing-style group authorization:
360
-
361
- - An unauthorized user can send `/mixin-group-auth` in the target group
362
- - The plugin replies with a temporary approval code for that `conversationId`
363
- - An operator must approve it in the OpenClaw terminal with `openclaw pairing approve mixin <code>`
364
- - For non-default accounts, use `openclaw pairing approve --account <accountId> mixin <code>`
365
- - Once approved, that entire group conversation is allowed without changing `openclaw.json`
366
- - Repeated `/mixin-group-auth` requests from the same unauthorized group are rate-limited to avoid spam
367
-
368
- Where to look in logs:
369
-
370
- - The plugin logs route resolution like `peer.kind=group, peer.id=<conversationId>`, which gives you the group `conversationId`
371
- - Unauthorized or filtered group logs include `group sender <user_id>` and `conversationId=<conversationId>`
372
- - If needed, temporarily enable a stricter group policy and let one member send a message once; the rejection log is often the fastest way to collect both values
5
+ > Supported on the latest OpenClaw 3.23 plugin architecture.
373
6
 
374
- ## Usage
375
-
376
- - Direct message: `/status` or `Hello`
377
- - Group message: `@Bot your question` with trigger words such as `?` or `help`
378
-
379
- ## Operations
380
-
381
- Useful OpenClaw commands:
382
-
383
- ```bash
384
- openclaw plugins list
385
- openclaw plugins info mixin
386
- openclaw plugins update mixin
387
- openclaw channels status --probe
388
- openclaw status
389
- ```
390
-
391
- Plugin-specific command:
392
-
393
- - Send `/mixin-outbox` to inspect the current pending queue size, next retry time, and latest error.
394
- - Send `/mixin-outbox purge-invalid` to remove old `APP_CARD` / `APP_BUTTON_GROUP` entries that are stuck on permanent invalid-field errors.
395
- - Send `/mixin-group-auth` in a group to create a pending group-authorization request.
396
- - Approve a pending group-authorization request in the OpenClaw terminal with `openclaw pairing approve mixin <code>`.
397
- - For non-default accounts, use `openclaw pairing approve --account <accountId> mixin <code>`.
398
- - Send `/collect status <orderId>` to refresh and inspect a stored MixPay collect order.
399
- - Send `/collect recent` or `/collect recent 10` to list recent MixPay collect orders for the current conversation.
400
-
401
- Companion onboarding CLI:
402
-
403
- - This repository also includes a companion CLI at `tools/mixin-plugin-onboard/README.md`.
404
- - It is bundled into the same npm package, `@invago/mixin`.
405
- - It currently provides `info`, `doctor`, `install`, and `update` commands for local OpenClaw + Mixin plugin maintenance.
406
- - Local examples:
407
- - `node --import jiti/register.js tools/mixin-plugin-onboard/src/index.ts info`
408
- - `node --import jiti/register.js tools/mixin-plugin-onboard/src/index.ts doctor`
409
- - Installed package examples:
410
- - `npx -y @invago/mixin info`
411
- - `npx -y @invago/mixin doctor`
412
-
413
- ## Delivery and Retry Behavior
414
-
415
- - Outbound messages are persisted to a local outbox before send attempts.
416
- - Failed sends are retried automatically until they succeed.
417
- - Pending messages survive plugin restarts.
418
- - Inbound Blaze messages are acknowledged before dispatch so Mixin receives a read receipt as early as possible.
419
-
420
- ## Media Support
421
-
422
- Current media behavior is split into outbound and inbound support:
423
-
424
- - OpenClaw native outbound media is enabled through the channel `sendMedia` path.
425
- - OpenClaw native `sendPayload` now uses the same Mixin outbound planner as buffered agent replies, so text/post/buttons/card/file/audio selection is consistent.
426
- - The plugin sends outbound audio as `PLAIN_AUDIO` when it can resolve the media as audio and detect duration.
427
- - If audio duration cannot be detected, the plugin falls back to regular file attachment sending.
428
- - Non-audio outbound media is sent as Mixin file attachments.
429
- - If OpenClaw sends both caption text and media, the plugin sends the text first and then the file.
430
- - Voice-bubble style outbound audio is currently intended for the explicit `mixin-audio` template path.
431
- - Inbound `PLAIN_DATA` and `PLAIN_AUDIO` messages are downloaded, saved locally, and attached to the OpenClaw inbound context through `MediaPath` / `MediaType`.
432
- - Group attachment messages are allowed through even when `requireMentionInGroup` is enabled, unless `mediaBypassMentionInGroup` is set to `false`.
433
-
434
- Current limits:
435
-
436
- - Outbound audio does not transcode automatically.
437
- - `mixin-audio` still requires a prepared local file, explicit `duration`, and optional `waveForm`.
438
- - OpenClaw native outbound audio depends on local `ffprobe` availability to detect duration.
439
- - OpenClaw native `sendMedia` still does not generate `waveForm`, so explicit `mixin-audio` remains the most deterministic path for polished voice-message output.
440
- - Whether the agent can summarize, transcribe, or reason over inbound files/audio depends on your OpenClaw media-understanding configuration.
441
-
442
- Manual test guide:
443
-
444
- - See [docs/media-testing.md](docs/media-testing.md) for ready-to-run prompts and expected results.
445
-
446
- ## MixPay Collect
447
-
448
- Mixin now supports MixPay collection through one-time payment orders.
449
-
450
- Current capabilities:
451
-
452
- - `mixin-collect` explicit reply template creates a MixPay collect order
453
- - Collect orders are stored locally under the OpenClaw state directory
454
- - Pending orders are polled in the background
455
- - Success and terminal status changes are sent back to the original conversation
456
- - `/collect status <orderId>` refreshes the order from MixPay before replying
457
- - `assetId` in the template can be omitted when `mixpay.defaultQuoteAssetId` is configured
458
-
459
- Template example:
460
-
461
- ````text
462
- ```mixin-collect
463
- {
464
- "amount": "1",
465
- "assetId": "c6d0c728-2624-429b-8e0d-d9d19b6592fa",
466
- "memo": "Order #1001"
467
- }
468
- ```
469
- ````
470
-
471
- Rules:
472
-
473
- - `amount` is required; `assetId` is required unless `mixpay.defaultQuoteAssetId` is configured
474
- - `settlementAssetId`, `memo`, `orderId`, and `expireMinutes` are optional
475
- - Payment success is confirmed from MixPay server-side query results, not only from the client page
476
- - `mixpay.allowedCreators` can restrict who is allowed to create collect orders
477
-
478
- Where funds arrive:
479
-
480
- - For MixPay `Mixin account`, funds settle into the linked Mixin Wallet
481
- - For MixPay `Mixin Robot account`, funds settle into the linked Mixin Robot Wallet
482
- - Other MixPay account types settle into their own linked wallet types
483
-
484
- Recommended setup for this plugin:
485
-
486
- - Use a MixPay `Mixin account` or `Mixin Robot account`
487
- - Use that account's UUID as `mixpay.payeeId`
488
- - Set both `mixpay.defaultQuoteAssetId` and `mixpay.defaultSettlementAssetId` if you want templates to stay short
489
-
490
- How to get the required values:
491
-
492
- - `mixpay.payeeId`: get the UUID from the [MixPay Dashboard](https://dashboard.mixpay.me) settings page, or use the MixPay helper bot described in the official getting-started guide
493
- - `mixpay.defaultQuoteAssetId`: choose the asset ID you want to quote prices in
494
- - `mixpay.defaultSettlementAssetId`: choose the asset ID you want funds to settle into
495
-
496
- Minimal recommended config:
497
-
498
- ```json
499
- {
500
- "channels": {
501
- "mixin": {
502
- "mixpay": {
503
- "enabled": true,
504
- "payeeId": "YOUR_MIXPAY_UUID",
505
- "defaultQuoteAssetId": "YOUR_QUOTE_ASSET_ID",
506
- "defaultSettlementAssetId": "YOUR_SETTLEMENT_ASSET_ID"
507
- }
508
- }
509
- }
510
- }
511
- ```
512
-
513
- Where to put it:
514
-
515
- - Single-account setup: put `mixpay` under `channels.mixin.mixpay`
516
- - Multi-account setup: put it under `channels.mixin.accounts.<accountId>.mixpay`
517
- - `mixpay` is account-scoped, so different Mixin bot accounts can use different MixPay settings
518
-
519
- Field reference:
520
-
521
- - `mixpay.enabled`: enable MixPay collect support for this Mixin account
522
- - `mixpay.apiBaseUrl`: optional custom MixPay API base URL; normally leave it empty and use the default official endpoint
523
- - `mixpay.payeeId`: the MixPay payee/merchant UUID that actually receives the funds; required when MixPay collect is enabled
524
- - `mixpay.defaultQuoteAssetId`: default quoted asset ID; when set, `mixin-collect` can omit `assetId`
525
- - `mixpay.defaultSettlementAssetId`: default settlement asset ID; controls which asset the order prefers to settle into
526
- - `mixpay.expireMinutes`: default expiration time for newly created collect orders
527
- - `mixpay.pollIntervalSec`: background polling interval for pending orders; shorter values detect paid orders faster but create more MixPay API traffic
528
- - `mixpay.allowedCreators`: optional sender UUID allowlist; when non-empty, only these users can create collect orders in chat
529
- - `mixpay.notifyOnPending`: whether to send a conversation update when MixPay reports the order as `pending`
530
- - `mixpay.notifyOnPaidLess`: whether to send a conversation update when MixPay reports an underpayment
531
-
532
- Practical guidance:
533
-
534
- - If you only want the smallest working setup, configure `enabled`, `payeeId`, `defaultQuoteAssetId`, and `defaultSettlementAssetId`
535
- - If you do not want everyone in an authorized chat to create collect orders, set `allowedCreators`
536
- - If you do not run a private MixPay gateway, leave `apiBaseUrl` unset
537
- - If you want fewer status messages in chat, keep `notifyOnPending: false`
538
-
539
- ## Explicit Reply Templates
540
-
541
- When you want deterministic Mixin output instead of heuristic auto-selection, have the agent reply with exactly one fenced template block.
542
-
543
- Text:
544
-
545
- ```text
546
- ```mixin-text
547
- Short plain reply.
548
- ```
549
- ```
550
-
551
- Post:
552
-
553
- ```text
554
- ```mixin-post
555
- # Release Notes
556
-
557
- - Item 1
558
- - Item 2
559
- ```
560
- ```
561
-
562
- Buttons:
563
-
564
- ```text
565
- ```mixin-buttons
566
- {
567
- "intro": "Choose an action",
568
- "buttons": [
569
- { "label": "Open Docs", "action": "https://docs.openclaw.ai" },
570
- { "label": "Open Mixin", "action": "https://developers.mixin.one" }
571
- ]
572
- }
573
- ```
574
- ```
575
-
576
- Card:
577
-
578
- ```text
579
- ```mixin-card
580
- {
581
- "title": "OpenClaw Docs",
582
- "description": "Open the official documentation site.",
583
- "action": "https://docs.openclaw.ai",
584
- "coverUrl": "https://example.com/cover.png",
585
- "shareable": true
586
- }
587
- ```
588
- ```
589
-
590
- File:
591
-
592
- ```text
593
- ```mixin-file
594
- {
595
- "filePath": "/absolute/path/to/report.pdf",
596
- "fileName": "report.pdf",
597
- "mimeType": "application/pdf"
598
- }
599
- ```
600
- ```
601
-
602
- Audio:
603
-
604
- ```text
605
- ```mixin-audio
606
- {
607
- "filePath": "/absolute/path/to/voice.ogg",
608
- "mimeType": "audio/ogg",
609
- "duration": 12,
610
- "waveForm": "AAMMQQ=="
611
- }
612
- ```
613
- ```
614
-
615
- Rules:
616
-
617
- - Explicit templates take priority over automatic detection.
618
- - Replies containing tables or fenced code blocks are sent as `mixin-post` by default.
619
- - `mixin-buttons` and `mixin-card` accept JSON only.
620
- - `mixin-file` and `mixin-audio` also accept JSON only.
621
- - `mixin-audio` requires `duration` in seconds. `waveForm` is optional.
622
- - `mixin-file` and `mixin-audio` require absolute local file paths on the machine where OpenClaw runs.
623
- - Invalid explicit `mixin-*` templates are no longer dropped silently; the plugin now sends a visible `Mixin template error: ...` message instead.
624
- - Button and card links must use `http://` or `https://`.
625
- - Mixin clients may require your target domains to be present in the bot app's `Resource Patterns` allowlist.
626
-
627
- ## Multi-Account Example
628
-
629
- ```json
630
- {
631
- "channels": {
632
- "mixin": {
633
- "accounts": {
634
- "bot1": {
635
- "name": "Customer Service Bot",
636
- "appId": "...",
637
- "sessionId": "...",
638
- "serverPublicKey": "...",
639
- "sessionPrivateKey": "...",
640
- "dmPolicy": "pairing",
641
- "allowFrom": ["..."]
642
- },
643
- "bot2": {
644
- "name": "Tech Support Bot",
645
- "appId": "...",
646
- "sessionId": "...",
647
- "serverPublicKey": "...",
648
- "sessionPrivateKey": "...",
649
- "proxy": {
650
- "enabled": true,
651
- "url": "http://127.0.0.1:7890"
652
- }
653
- }
654
- }
655
- }
656
- }
657
- }
658
- ```
659
-
660
- ## Troubleshooting
661
-
662
- | Problem | What to check |
663
- |---------|---------------|
664
- | Plugin not loaded | Run `openclaw plugins list` and `openclaw plugins info mixin` |
665
- | Channel not starting | Verify `channels.mixin` exists and credentials are complete |
666
- | Not receiving messages | Check pairing approval or `allowFrom`, trigger words, and Blaze connectivity |
667
- | Messages not sending | Check proxy reachability, outbox backlog, and `/mixin-outbox` output |
668
- | Repeated inbound pushes | Check Blaze connectivity and confirm ACK logs/behavior |
669
-
670
- ## Security Notes
671
-
672
- - Keep `sessionPrivateKey` private.
673
- - Use `dmPolicy: "pairing"` or a strict `allowFrom` list in production.
674
- - Outbox files contain pending message bodies, so do not expose the `data/` directory.
675
-
676
- ## Links
677
-
678
- - [OpenClaw Documentation](https://openclaw.ai)
679
- - [OpenClaw Plugins](https://docs.openclaw.ai/tools/plugin)
680
- - [OpenClaw Plugin CLI](https://docs.openclaw.ai/cli/plugins)
681
- - [OpenClaw Configuration](https://docs.openclaw.ai/gateway/configuration)
682
- - [OpenClaw Configuration Reference](https://docs.openclaw.ai/gateway/configuration-reference)
683
- - [Mixin Developers Dashboard](https://developers.mixin.one/dashboard)
684
- - [Mixin Bot API Documentation](https://developers.mixin.one/docs/bot-api)
7
+ **[Chinese Documentation](README.zh-CN.md)**
8
+
9
+ ## Overview
10
+
11
+ MixinClaw is an OpenClaw channel plugin. It runs in the same process as the OpenClaw Gateway, receives inbound messages from Mixin Blaze WebSocket, and delivers outbound messages over the Mixin HTTP API.
12
+
13
+ Important:
14
+
15
+ - Install the plugin on the same machine where the OpenClaw Gateway runs.
16
+ - OpenClaw config files use JSON5, so comments and trailing commas are allowed.
17
+ - The proxy configured by this plugin only affects this plugin.
18
+
19
+ ## Recommended Install
20
+
21
+ Use the OpenClaw plugin installer:
22
+
23
+ ```bash
24
+ openclaw plugins install @invago/mixin
25
+ ```
26
+
27
+ `@invago/mixin` is the published npm package name. The OpenClaw runtime/plugin name remains `mixin`.
28
+
29
+ If the plugin is already installed, upgrade it with the plugin id:
30
+
31
+ ```bash
32
+ openclaw plugins update mixin
33
+ ```
34
+
35
+ To install a specific version for the first time:
36
+
37
+ ```bash
38
+ openclaw plugins install @invago/mixin@<version>
39
+ ```
40
+
41
+ Then confirm the plugin is installed:
42
+
43
+ ```bash
44
+ openclaw plugins list
45
+ openclaw plugins info mixin
46
+ ```
47
+
48
+ ## Local Development Install
49
+
50
+ If you are developing locally, clone the repository and install dependencies:
51
+
52
+ ```bash
53
+ git clone https://github.com/invago/mixinclaw.git
54
+ cd mixinclaw
55
+ npm install
56
+ ```
57
+
58
+ Then install it into OpenClaw from the local path:
59
+
60
+ ```bash
61
+ openclaw plugins install .
62
+ ```
63
+
64
+ ## Create a Mixin Bot
65
+
66
+ Go to [Mixin Developers Dashboard](https://developers.mixin.one/dashboard), create a bot, and collect:
67
+
68
+ - `appId`
69
+ - `sessionId`
70
+ - `serverPublicKey`
71
+ - `sessionPrivateKey`
72
+
73
+ ## Configuration
74
+
75
+ Edit your `openclaw.json` file manually and add both the channel configuration and the plugin enablement block:
76
+
77
+ ```json
78
+ {
79
+ "channels": {
80
+ "mixin": {
81
+ "defaultAccount": "default",
82
+ "appId": "YOUR_APP_ID",
83
+ "sessionId": "YOUR_SESSION_ID",
84
+ "serverPublicKey": "YOUR_SERVER_PUBLIC_KEY_BASE64",
85
+ "sessionPrivateKey": "YOUR_SESSION_PRIVATE_KEY_BASE64",
86
+ "dmPolicy": "pairing",
87
+ "allowFrom": ["AUTHORIZED_USER_UUID"],
88
+ "requireMentionInGroup": true,
89
+ "mediaBypassMentionInGroup": true,
90
+ "mediaMaxMb": 30,
91
+ "audioSendAsVoiceByDefault": true,
92
+ "audioAutoDetectDuration": true,
93
+ "audioRequireFfprobe": false,
94
+ "mixpay": {
95
+ "enabled": true,
96
+ "payeeId": "YOUR_MIXPAY_PAYEE_ID",
97
+ "defaultSettlementAssetId": "YOUR_SETTLEMENT_ASSET_ID",
98
+ "expireMinutes": 15,
99
+ "pollIntervalSec": 30,
100
+ "allowedCreators": ["AUTHORIZED_USER_UUID"],
101
+ "notifyOnPending": false,
102
+ "notifyOnPaidLess": true
103
+ },
104
+ "proxy": {
105
+ "enabled": true,
106
+ "url": "socks5://127.0.0.1:10808",
107
+ "username": "proxy-user",
108
+ "password": "proxy-pass"
109
+ }
110
+ }
111
+ },
112
+ "plugins": {
113
+ "allow": ["mixin"],
114
+ "entries": {
115
+ "mixin": {
116
+ "enabled": true
117
+ }
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ Notes:
124
+
125
+ - `channels.mixin` configures the channel itself.
126
+ - `plugins.allow` and `plugins.entries.mixin.enabled` are also required so OpenClaw loads this plugin.
127
+ - Mixin supports the standard OpenClaw direct-message policies. The recommended setting is `dmPolicy: "pairing"`.
128
+ - `allowFrom` remains useful for pre-authorized users or manual overrides. Pairing approvals are stored in OpenClaw's pairing allowlist store.
129
+ - If `proxy.url` already contains credentials, `proxy.username` and `proxy.password` can be omitted.
130
+
131
+ ## Pairing
132
+
133
+ For private chats, the recommended mode is:
134
+
135
+ ```json
136
+ {
137
+ "channels": {
138
+ "mixin": {
139
+ "dmPolicy": "pairing"
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ Behavior:
146
+
147
+ - A new, unauthorized Mixin user gets an 8-character pairing code in the DM.
148
+ - Approve that user with `openclaw pairing approve mixin <code>`.
149
+ - Use `openclaw pairing list mixin` to inspect pending pairing requests.
150
+ - Once approved, the user is added to OpenClaw's pairing allowlist store for the `mixin` channel.
151
+ - `allowFrom` is still honored and can be used alongside pairing for users you want to pre-authorize.
152
+
153
+ ## Avoid Cross-Channel Session Mixing
154
+
155
+ Mixin group chats already stay isolated by channel, but direct-message sessions follow the OpenClaw `session.dmScope` policy. If you keep the default `main` scope, Mixin direct messages can share the same main session with other channels such as Feishu.
156
+
157
+ Recommended configuration:
158
+
159
+ ```json
160
+ {
161
+ "session": {
162
+ "dmScope": "per-channel-peer"
163
+ }
164
+ }
165
+ ```
166
+
167
+ Use `per-account-channel-peer` instead if you run multiple Mixin accounts and want direct-message sessions isolated by both channel and account.
168
+
169
+ ## Multi-Agent Routing Per Bot Account
170
+
171
+ OpenClaw supports routing different channel accounts to different agents through `bindings[].match.accountId`.
172
+
173
+ Recommended pattern:
174
+
175
+ - One Mixin bot account = one `accountId`
176
+ - One `accountId` = one agent binding
177
+ - Keep session isolation at `per-account-channel-peer` when you run multiple bot accounts
178
+
179
+ Example:
180
+
181
+ ```json
182
+ {
183
+ "session": {
184
+ "dmScope": "per-account-channel-peer"
185
+ },
186
+ "agents": {
187
+ "list": [
188
+ {
189
+ "id": "main",
190
+ "workspace": "E:/AI/workspace-main",
191
+ "default": true
192
+ },
193
+ {
194
+ "id": "sales",
195
+ "workspace": "E:/AI/workspace-sales"
196
+ },
197
+ {
198
+ "id": "support",
199
+ "workspace": "E:/AI/workspace-support"
200
+ }
201
+ ]
202
+ },
203
+ "bindings": [
204
+ {
205
+ "agentId": "main",
206
+ "match": {
207
+ "channel": "mixin",
208
+ "accountId": "default"
209
+ }
210
+ },
211
+ {
212
+ "agentId": "sales",
213
+ "match": {
214
+ "channel": "mixin",
215
+ "accountId": "sales"
216
+ }
217
+ },
218
+ {
219
+ "agentId": "support",
220
+ "match": {
221
+ "channel": "mixin",
222
+ "accountId": "support"
223
+ }
224
+ }
225
+ ],
226
+ "channels": {
227
+ "mixin": {
228
+ "defaultAccount": "default",
229
+ "accounts": {
230
+ "default": {
231
+ "name": "Main Bot",
232
+ "appId": "APP_ID_1",
233
+ "sessionId": "SESSION_ID_1",
234
+ "serverPublicKey": "SERVER_PUBLIC_KEY_1",
235
+ "sessionPrivateKey": "SESSION_PRIVATE_KEY_1"
236
+ },
237
+ "sales": {
238
+ "name": "Sales Bot",
239
+ "appId": "APP_ID_2",
240
+ "sessionId": "SESSION_ID_2",
241
+ "serverPublicKey": "SERVER_PUBLIC_KEY_2",
242
+ "sessionPrivateKey": "SESSION_PRIVATE_KEY_2"
243
+ },
244
+ "support": {
245
+ "name": "Support Bot",
246
+ "appId": "APP_ID_3",
247
+ "sessionId": "SESSION_ID_3",
248
+ "serverPublicKey": "SERVER_PUBLIC_KEY_3",
249
+ "sessionPrivateKey": "SESSION_PRIVATE_KEY_3"
250
+ }
251
+ }
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ Notes:
258
+
259
+ - `match.accountId` binds one Mixin bot account to one agent.
260
+ - If `accountId` is omitted in a binding, OpenClaw treats it as the default account only.
261
+ - Use `accountId: "*"` only when you want one fallback agent for all Mixin accounts.
262
+ - If you need one specific group or DM to override the account-level routing, add a more specific `match.peer` binding. Peer matches win over `accountId` matches.
263
+
264
+ ## Configuration Reference
265
+
266
+ | Parameter | Required | Default | Description |
267
+ |-----------|----------|---------|-------------|
268
+ | `defaultAccount` | No | `default` | Default account ID used when `accounts` is configured |
269
+ | `appId` | Yes | - | Mixin App UUID |
270
+ | `sessionId` | Yes | - | Session UUID |
271
+ | `serverPublicKey` | Yes | - | Server Public Key (Base64) |
272
+ | `sessionPrivateKey` | Yes | - | Session Private Key (Ed25519 Base64) |
273
+ | `dmPolicy` | No | `pairing` | Direct-message policy: `pairing`, `allowlist`, `open`, or `disabled` |
274
+ | `allowFrom` | No | `[]` | Authorized user UUID whitelist |
275
+ | `groupPolicy` | No | OpenClaw default | Group-message policy: `open`, `allowlist`, or `disabled` |
276
+ | `groupAllowFrom` | No | `[]` | Authorized sender UUID whitelist for group messages when `groupPolicy` uses allowlisting |
277
+ | `requireMentionInGroup` | No | `true` | Apply plugin-side trigger-word filtering to group messages that have already been delivered to the bot |
278
+ | `mediaBypassMentionInGroup` | No | `true` | Allow inbound group file/audio messages through even without trigger text |
279
+ | `mediaMaxMb` | No | `30` | Max inbound and outbound media size in MB |
280
+ | `audioSendAsVoiceByDefault` | No | `true` | Send OpenClaw native outbound audio as Mixin voice when possible |
281
+ | `audioAutoDetectDuration` | No | `true` | Detect native outbound audio duration with `ffprobe` before sending voice |
282
+ | `audioRequireFfprobe` | No | `false` | Fail native outbound audio instead of falling back to file when duration detection is unavailable |
283
+ | `mixpay.enabled` | No | `false` | Enable MixPay collect support for this Mixin account |
284
+ | `mixpay.payeeId` | Required when enabled | - | MixPay merchant/payee ID used to create one-time payment orders |
285
+ | `mixpay.defaultQuoteAssetId` | No | - | Default quote asset ID for collect templates or future collect commands |
286
+ | `mixpay.defaultSettlementAssetId` | No | - | Default settlement asset ID for MixPay orders |
287
+ | `mixpay.expireMinutes` | No | `15` | Default MixPay order expiration time in minutes |
288
+ | `mixpay.pollIntervalSec` | No | `30` | Poll interval in seconds for pending MixPay orders |
289
+ | `mixpay.allowedCreators` | No | `[]` | Optional sender UUID allowlist for creating MixPay collect orders |
290
+ | `mixpay.notifyOnPending` | No | `false` | Notify the chat when MixPay reports `pending` |
291
+ | `mixpay.notifyOnPaidLess` | No | `true` | Notify the chat when MixPay indicates an underpayment |
292
+ | `conversations.<conversationId>.enabled` | No | `true` | Enable or disable a specific group conversation |
293
+ | `conversations.<conversationId>.requireMention` | No | Inherit account | Override group trigger-word requirement for a specific conversation |
294
+ | `conversations.<conversationId>.allowFrom` | No | Inherit account | Override group sender allowlist for a specific conversation |
295
+ | `conversations.<conversationId>.mediaBypassMention` | No | Inherit account | Override whether file/audio messages bypass mention filtering |
296
+ | `conversations.<conversationId>.groupPolicy` | No | Inherit account | Override group policy for a specific conversation |
297
+ | `debug` | No | `false` | Debug mode |
298
+ | `proxy.enabled` | No | `false` | Enable per-plugin proxy |
299
+ | `proxy.url` | Required when enabled | - | Proxy URL such as `http://127.0.0.1:7890` or `socks5://127.0.0.1:10808` |
300
+ | `proxy.username` | No | - | Proxy username |
301
+ | `proxy.password` | No | - | Proxy password |
302
+
303
+ ## Proxy
304
+
305
+ - Both Mixin HTTP requests and Blaze WebSocket traffic use the same proxy.
306
+ - Supported proxy URL styles depend on the underlying proxy agent stack; typical values are `http://...`, `https://...`, and `socks5://...`.
307
+ - You must provide your own proxy software or proxy server. The plugin only consumes a proxy, it does not create one.
308
+
309
+ ## Group Access Control
310
+
311
+ Mixin now supports formal group access controls in addition to direct-message `dmPolicy`.
312
+
313
+ - `groupPolicy: "open"` allows any sender in a group conversation.
314
+ - `groupPolicy: "allowlist"` requires the sender UUID to appear in `groupAllowFrom`.
315
+ - `groupPolicy: "disabled"` blocks the entire conversation.
316
+ - `conversations.<conversationId>` overrides account-level group settings for that single conversation.
317
+
318
+ Important delivery boundary:
319
+
320
+ - In practice, Mixin group bots reliably receive messages when the bot is explicitly mentioned.
321
+ - `requireMentionInGroup: false` only disables this plugin's own post-delivery filtering.
322
+ - It does not guarantee that Mixin will deliver every non-mention group message to the bot.
323
+ - If a non-mention group message produces no read receipt and no inbound log, the message most likely was not delivered to the plugin by Mixin in the first place.
324
+
325
+ Example:
326
+
327
+ ```json
328
+ {
329
+ "channels": {
330
+ "mixin": {
331
+ "groupPolicy": "allowlist",
332
+ "groupAllowFrom": ["USER_A_UUID"],
333
+ "conversations": {
334
+ "70000000-0000-0000-0000-000000000001": {
335
+ "requireMention": false,
336
+ "allowFrom": ["USER_B_UUID"],
337
+ "mediaBypassMention": false
338
+ },
339
+ "70000000-0000-0000-0000-000000000002": {
340
+ "enabled": false
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ ```
347
+
348
+ How to get these values:
349
+
350
+ - `conversations.<conversationId>`: use the group's `conversation_id`. In practice, the easiest way is to let the group send a message to the bot once, then read the `conversationId` from the plugin logs or inbound event context. Mixin's conversation APIs also use the same `conversation_id` field for group conversations.
351
+ - `groupAllowFrom` or `conversations.<conversationId>.allowFrom`: use the sender's Mixin `user_id` UUID. Mixin user IDs can be learned when the user messages the bot, adds the bot as a contact, or authorizes the application.
352
+ - If you manage the group through Mixin APIs, the returned conversation payload also includes group participants with their `user_id` fields.
353
+
354
+ Recommended operational approach:
355
+
356
+ - Let the target group send one message to the bot
357
+ - Copy the logged `conversationId`
358
+ - Let the target member send one message, then copy that sender's `user_id`
359
+ - Put those values into `conversations.<conversationId>` and `groupAllowFrom` / `allowFrom`
360
+
361
+ Pairing-style group authorization:
362
+
363
+ - An unauthorized user can send `/mixin-group-auth` in the target group
364
+ - The plugin replies with a temporary approval code for that `conversationId`
365
+ - An operator must approve it in the OpenClaw terminal with `openclaw pairing approve mixin <code>`
366
+ - For non-default accounts, use `openclaw pairing approve --account <accountId> mixin <code>`
367
+ - Once approved, that entire group conversation is allowed without changing `openclaw.json`
368
+ - Repeated `/mixin-group-auth` requests from the same unauthorized group are rate-limited to avoid spam
369
+
370
+ Where to look in logs:
371
+
372
+ - The plugin logs route resolution like `peer.kind=group, peer.id=<conversationId>`, which gives you the group `conversationId`
373
+ - Unauthorized or filtered group logs include `group sender <user_id>` and `conversationId=<conversationId>`
374
+ - If needed, temporarily enable a stricter group policy and let one member send a message once; the rejection log is often the fastest way to collect both values
375
+
376
+ ## Usage
377
+
378
+ - Direct message: `/status` or `Hello`
379
+ - Group message: `@Bot your question` with trigger words such as `?` or `help`
380
+
381
+ ## Operations
382
+
383
+ Useful OpenClaw commands:
384
+
385
+ ```bash
386
+ openclaw plugins list
387
+ openclaw plugins info mixin
388
+ openclaw plugins update mixin
389
+ openclaw channels status --probe
390
+ openclaw status
391
+ ```
392
+
393
+ Plugin-specific command:
394
+
395
+ - Send `/mixin-outbox` to inspect the current pending queue size, next retry time, and latest error.
396
+ - Send `/mixin-outbox purge-invalid` to remove old `APP_CARD` / `APP_BUTTON_GROUP` entries that are stuck on permanent invalid-field errors.
397
+ - Send `/mixin-group-auth` in a group to create a pending group-authorization request.
398
+ - Approve a pending group-authorization request in the OpenClaw terminal with `openclaw pairing approve mixin <code>`.
399
+ - For non-default accounts, use `openclaw pairing approve --account <accountId> mixin <code>`.
400
+ - Send `/collect status <orderId>` to refresh and inspect a stored MixPay collect order.
401
+ - Send `/collect recent` or `/collect recent 10` to list recent MixPay collect orders for the current conversation.
402
+
403
+ Companion onboarding CLI:
404
+
405
+ - This repository also includes a companion CLI at `tools/mixin-plugin-onboard/README.md`.
406
+ - It is bundled into the same npm package, `@invago/mixin`.
407
+ - It currently provides `info`, `doctor`, `install`, and `update` commands for local OpenClaw + Mixin plugin maintenance.
408
+ - Local examples:
409
+ - `node --import jiti/register.js tools/mixin-plugin-onboard/src/index.ts info`
410
+ - `node --import jiti/register.js tools/mixin-plugin-onboard/src/index.ts doctor`
411
+ - Installed package examples:
412
+ - `npx -y @invago/mixin info`
413
+ - `npx -y @invago/mixin doctor`
414
+
415
+ ## Delivery and Retry Behavior
416
+
417
+ - Outbound messages are persisted to a local outbox before send attempts.
418
+ - Failed sends are retried automatically until they succeed.
419
+ - Pending messages survive plugin restarts.
420
+ - Inbound Blaze messages are acknowledged before dispatch so Mixin receives a read receipt as early as possible.
421
+
422
+ ## Media Support
423
+
424
+ Current media behavior is split into outbound and inbound support:
425
+
426
+ - OpenClaw native outbound media is enabled through the channel `sendMedia` path.
427
+ - OpenClaw native `sendPayload` now uses the same Mixin outbound planner as buffered agent replies, so text/post/buttons/card/file/audio selection is consistent.
428
+ - The plugin sends outbound audio as `PLAIN_AUDIO` when it can resolve the media as audio and detect duration.
429
+ - If audio duration cannot be detected, the plugin falls back to regular file attachment sending.
430
+ - Non-audio outbound media is sent as Mixin file attachments.
431
+ - If OpenClaw sends both caption text and media, the plugin sends the text first and then the file.
432
+ - Voice-bubble style outbound audio is currently intended for the explicit `mixin-audio` template path.
433
+ - Inbound `PLAIN_DATA` and `PLAIN_AUDIO` messages are downloaded, saved locally, and attached to the OpenClaw inbound context through `MediaPath` / `MediaType`.
434
+ - Group attachment messages are allowed through even when `requireMentionInGroup` is enabled, unless `mediaBypassMentionInGroup` is set to `false`.
435
+
436
+ Current limits:
437
+
438
+ - Outbound audio does not transcode automatically.
439
+ - `mixin-audio` still requires a prepared local file, explicit `duration`, and optional `waveForm`.
440
+ - OpenClaw native outbound audio depends on local `ffprobe` availability to detect duration.
441
+ - OpenClaw native `sendMedia` still does not generate `waveForm`, so explicit `mixin-audio` remains the most deterministic path for polished voice-message output.
442
+ - Whether the agent can summarize, transcribe, or reason over inbound files/audio depends on your OpenClaw media-understanding configuration.
443
+
444
+ Manual test guide:
445
+
446
+ - See [docs/media-testing.md](docs/media-testing.md) for ready-to-run prompts and expected results.
447
+
448
+ ## MixPay Collect
449
+
450
+ Mixin now supports MixPay collection through one-time payment orders.
451
+
452
+ Current capabilities:
453
+
454
+ - `mixin-collect` explicit reply template creates a MixPay collect order
455
+ - Collect orders are stored locally under the OpenClaw state directory
456
+ - Pending orders are polled in the background
457
+ - Success and terminal status changes are sent back to the original conversation
458
+ - `/collect status <orderId>` refreshes the order from MixPay before replying
459
+ - `assetId` in the template can be omitted when `mixpay.defaultQuoteAssetId` is configured
460
+
461
+ Template example:
462
+
463
+ ````text
464
+ ```mixin-collect
465
+ {
466
+ "amount": "1",
467
+ "assetId": "c6d0c728-2624-429b-8e0d-d9d19b6592fa",
468
+ "memo": "Order #1001"
469
+ }
470
+ ```
471
+ ````
472
+
473
+ Rules:
474
+
475
+ - `amount` is required; `assetId` is required unless `mixpay.defaultQuoteAssetId` is configured
476
+ - `settlementAssetId`, `memo`, `orderId`, and `expireMinutes` are optional
477
+ - Payment success is confirmed from MixPay server-side query results, not only from the client page
478
+ - `mixpay.allowedCreators` can restrict who is allowed to create collect orders
479
+
480
+ Where funds arrive:
481
+
482
+ - For MixPay `Mixin account`, funds settle into the linked Mixin Wallet
483
+ - For MixPay `Mixin Robot account`, funds settle into the linked Mixin Robot Wallet
484
+ - Other MixPay account types settle into their own linked wallet types
485
+
486
+ Recommended setup for this plugin:
487
+
488
+ - Use a MixPay `Mixin account` or `Mixin Robot account`
489
+ - Use that account's UUID as `mixpay.payeeId`
490
+ - Set both `mixpay.defaultQuoteAssetId` and `mixpay.defaultSettlementAssetId` if you want templates to stay short
491
+
492
+ How to get the required values:
493
+
494
+ - `mixpay.payeeId`: get the UUID from the [MixPay Dashboard](https://dashboard.mixpay.me) settings page, or use the MixPay helper bot described in the official getting-started guide
495
+ - `mixpay.defaultQuoteAssetId`: choose the asset ID you want to quote prices in
496
+ - `mixpay.defaultSettlementAssetId`: choose the asset ID you want funds to settle into
497
+
498
+ Minimal recommended config:
499
+
500
+ ```json
501
+ {
502
+ "channels": {
503
+ "mixin": {
504
+ "mixpay": {
505
+ "enabled": true,
506
+ "payeeId": "YOUR_MIXPAY_UUID",
507
+ "defaultQuoteAssetId": "YOUR_QUOTE_ASSET_ID",
508
+ "defaultSettlementAssetId": "YOUR_SETTLEMENT_ASSET_ID"
509
+ }
510
+ }
511
+ }
512
+ }
513
+ ```
514
+
515
+ Where to put it:
516
+
517
+ - Single-account setup: put `mixpay` under `channels.mixin.mixpay`
518
+ - Multi-account setup: put it under `channels.mixin.accounts.<accountId>.mixpay`
519
+ - `mixpay` is account-scoped, so different Mixin bot accounts can use different MixPay settings
520
+
521
+ Field reference:
522
+
523
+ - `mixpay.enabled`: enable MixPay collect support for this Mixin account
524
+ - `mixpay.apiBaseUrl`: optional custom MixPay API base URL; normally leave it empty and use the default official endpoint
525
+ - `mixpay.payeeId`: the MixPay payee/merchant UUID that actually receives the funds; required when MixPay collect is enabled
526
+ - `mixpay.defaultQuoteAssetId`: default quoted asset ID; when set, `mixin-collect` can omit `assetId`
527
+ - `mixpay.defaultSettlementAssetId`: default settlement asset ID; controls which asset the order prefers to settle into
528
+ - `mixpay.expireMinutes`: default expiration time for newly created collect orders
529
+ - `mixpay.pollIntervalSec`: background polling interval for pending orders; shorter values detect paid orders faster but create more MixPay API traffic
530
+ - `mixpay.allowedCreators`: optional sender UUID allowlist; when non-empty, only these users can create collect orders in chat
531
+ - `mixpay.notifyOnPending`: whether to send a conversation update when MixPay reports the order as `pending`
532
+ - `mixpay.notifyOnPaidLess`: whether to send a conversation update when MixPay reports an underpayment
533
+
534
+ Practical guidance:
535
+
536
+ - If you only want the smallest working setup, configure `enabled`, `payeeId`, `defaultQuoteAssetId`, and `defaultSettlementAssetId`
537
+ - If you do not want everyone in an authorized chat to create collect orders, set `allowedCreators`
538
+ - If you do not run a private MixPay gateway, leave `apiBaseUrl` unset
539
+ - If you want fewer status messages in chat, keep `notifyOnPending: false`
540
+
541
+ ## Explicit Reply Templates
542
+
543
+ When you want deterministic Mixin output instead of heuristic auto-selection, have the agent reply with exactly one fenced template block.
544
+
545
+ Text:
546
+
547
+ ```text
548
+ ```mixin-text
549
+ Short plain reply.
550
+ ```
551
+ ```
552
+
553
+ Post:
554
+
555
+ ```text
556
+ ```mixin-post
557
+ # Release Notes
558
+
559
+ - Item 1
560
+ - Item 2
561
+ ```
562
+ ```
563
+
564
+ Buttons:
565
+
566
+ ```text
567
+ ```mixin-buttons
568
+ {
569
+ "intro": "Choose an action",
570
+ "buttons": [
571
+ { "label": "Open Docs", "action": "https://docs.openclaw.ai" },
572
+ { "label": "Open Mixin", "action": "https://developers.mixin.one" }
573
+ ]
574
+ }
575
+ ```
576
+ ```
577
+
578
+ Card:
579
+
580
+ ```text
581
+ ```mixin-card
582
+ {
583
+ "title": "OpenClaw Docs",
584
+ "description": "Open the official documentation site.",
585
+ "action": "https://docs.openclaw.ai",
586
+ "coverUrl": "https://example.com/cover.png",
587
+ "shareable": true
588
+ }
589
+ ```
590
+ ```
591
+
592
+ File:
593
+
594
+ ```text
595
+ ```mixin-file
596
+ {
597
+ "filePath": "/absolute/path/to/report.pdf",
598
+ "fileName": "report.pdf",
599
+ "mimeType": "application/pdf"
600
+ }
601
+ ```
602
+ ```
603
+
604
+ Audio:
605
+
606
+ ```text
607
+ ```mixin-audio
608
+ {
609
+ "filePath": "/absolute/path/to/voice.ogg",
610
+ "mimeType": "audio/ogg",
611
+ "duration": 12,
612
+ "waveForm": "AAMMQQ=="
613
+ }
614
+ ```
615
+ ```
616
+
617
+ Rules:
618
+
619
+ - Explicit templates take priority over automatic detection.
620
+ - Replies containing tables or fenced code blocks are sent as `mixin-post` by default.
621
+ - `mixin-buttons` and `mixin-card` accept JSON only.
622
+ - `mixin-file` and `mixin-audio` also accept JSON only.
623
+ - `mixin-audio` requires `duration` in seconds. `waveForm` is optional.
624
+ - `mixin-file` and `mixin-audio` require absolute local file paths on the machine where OpenClaw runs.
625
+ - Invalid explicit `mixin-*` templates are no longer dropped silently; the plugin now sends a visible `Mixin template error: ...` message instead.
626
+ - Button and card links must use `http://` or `https://`.
627
+ - Mixin clients may require your target domains to be present in the bot app's `Resource Patterns` allowlist.
628
+
629
+ ## Multi-Account Example
630
+
631
+ ```json
632
+ {
633
+ "channels": {
634
+ "mixin": {
635
+ "accounts": {
636
+ "bot1": {
637
+ "name": "Customer Service Bot",
638
+ "appId": "...",
639
+ "sessionId": "...",
640
+ "serverPublicKey": "...",
641
+ "sessionPrivateKey": "...",
642
+ "dmPolicy": "pairing",
643
+ "allowFrom": ["..."]
644
+ },
645
+ "bot2": {
646
+ "name": "Tech Support Bot",
647
+ "appId": "...",
648
+ "sessionId": "...",
649
+ "serverPublicKey": "...",
650
+ "sessionPrivateKey": "...",
651
+ "proxy": {
652
+ "enabled": true,
653
+ "url": "http://127.0.0.1:7890"
654
+ }
655
+ }
656
+ }
657
+ }
658
+ }
659
+ }
660
+ ```
661
+
662
+ ## Troubleshooting
663
+
664
+ | Problem | What to check |
665
+ |---------|---------------|
666
+ | Plugin not loaded | Run `openclaw plugins list` and `openclaw plugins info mixin` |
667
+ | Channel not starting | Verify `channels.mixin` exists and credentials are complete |
668
+ | Not receiving messages | Check pairing approval or `allowFrom`, trigger words, and Blaze connectivity |
669
+ | Messages not sending | Check proxy reachability, outbox backlog, and `/mixin-outbox` output |
670
+ | Repeated inbound pushes | Check Blaze connectivity and confirm ACK logs/behavior |
671
+
672
+ ## Security Notes
673
+
674
+ - Keep `sessionPrivateKey` private.
675
+ - Use `dmPolicy: "pairing"` or a strict `allowFrom` list in production.
676
+ - Outbox files contain pending message bodies, so do not expose the `data/` directory.
677
+
678
+ ## Links
679
+
680
+ - [OpenClaw Documentation](https://openclaw.ai)
681
+ - [OpenClaw Plugins](https://docs.openclaw.ai/tools/plugin)
682
+ - [OpenClaw Plugin CLI](https://docs.openclaw.ai/cli/plugins)
683
+ - [OpenClaw Configuration](https://docs.openclaw.ai/gateway/configuration)
684
+ - [OpenClaw Configuration Reference](https://docs.openclaw.ai/gateway/configuration-reference)
685
+ - [Mixin Developers Dashboard](https://developers.mixin.one/dashboard)
686
+ - [Mixin Bot API Documentation](https://developers.mixin.one/docs/bot-api)
687
+
688
+ ## OpenClaw 3.23 notes
689
+
690
+ - The plugin manifest is `openclaw.plugin.json`.
691
+ - Channel config stays under `channels.mixin` and `channels.mixin.accounts.<accountId>`.
692
+ - Host-side diagnostics are available as `/setup`, `/setup single`, `/setup multi`, `/mixin-status`, `/mixin-accounts`, and `/mixin-help`.
693
+ - For local development, prefer `openclaw plugins install -l .`.
694
+
695
+ - Use `/setup` for the guided setup flow.