@emotion-machine/claw-messenger 0.1.2 → 0.1.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/README.md CHANGED
@@ -10,7 +10,7 @@ openclaw plugins install @emotion-machine/claw-messenger
10
10
 
11
11
  ## Configuration
12
12
 
13
- After installing, add to your OpenClaw config under `channels`:
13
+ After installing, add to your config under `channels`:
14
14
 
15
15
  ```json5
16
16
  {
@@ -61,4 +61,4 @@ The plugin registers two tools your agent can call:
61
61
 
62
62
  ## License
63
63
 
64
- UNLICENSED
64
+ UNLICENSED
package/dist/channel.d.ts CHANGED
@@ -14,5 +14,10 @@ export declare function getConnectionStatus(): {
14
14
  preferredService: string;
15
15
  accountId: string;
16
16
  };
17
+ export declare function createGroup(to: string[], text: string): Promise<{
18
+ ok: boolean;
19
+ messageId: string;
20
+ chatId: string;
21
+ }>;
17
22
  export declare const clawMessengerPlugin: ChannelPlugin<ResolvedAccount>;
18
23
  export {};
package/dist/channel.js CHANGED
@@ -41,6 +41,19 @@ export function getConnectionStatus() {
41
41
  accountId: account.accountId,
42
42
  };
43
43
  }
44
+ export async function createGroup(to, text) {
45
+ const runtime = getRuntime();
46
+ const cfg = runtime.config.loadConfig();
47
+ const account = resolveAccount(cfg);
48
+ const ws = wsClients.get(account.accountId);
49
+ if (!ws)
50
+ throw new Error("Not connected to claw-messenger");
51
+ if (!Array.isArray(to) || to.length < 2) {
52
+ throw new Error("Group requires at least 2 recipients");
53
+ }
54
+ const result = await sendToNewGroup(ws, to, text, account.preferredService);
55
+ return { ok: true, ...result };
56
+ }
44
57
  // -- Channel Plugin --
45
58
  const meta = {
46
59
  label: "Claw Messenger",
@@ -145,6 +158,7 @@ export const clawMessengerPlugin = {
145
158
  "Use reactions naturally — the way a real person would in iMessage.",
146
159
  ],
147
160
  },
161
+ // Legacy API (OpenClaw <2026.3.22): kept for backward compatibility
148
162
  actions: {
149
163
  listActions: () => ["send", "react"],
150
164
  handleAction: async ({ action, params, cfg }) => {
@@ -373,6 +387,19 @@ export const clawMessengerPlugin = {
373
387
  },
374
388
  },
375
389
  };
390
+ // OpenClaw 2026.3.22+ message-action-discovery API.
391
+ // Added as a runtime property because the ChannelPlugin type from older SDK
392
+ // versions doesn't include it. Newer OpenClaw calls this; older versions ignore it.
393
+ clawMessengerPlugin.describeMessageTool = (cfg) => {
394
+ const account = resolveAccount(cfg);
395
+ const ws = wsClients.get(account.accountId);
396
+ const connected = Boolean(ws?.connected);
397
+ return {
398
+ actions: connected ? ["send", "react"] : [],
399
+ capabilities: [],
400
+ schema: null,
401
+ };
402
+ };
376
403
  // -- Inbound message handler --
377
404
  async function handleInboundMessage(data, accountId, account, ctx) {
378
405
  const from = data.from;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
2
2
  import { Type } from "@sinclair/typebox";
3
- import { clawMessengerPlugin, getConnectionStatus } from "./channel.js";
3
+ import { clawMessengerPlugin, getConnectionStatus, createGroup } from "./channel.js";
4
4
  import { setRuntime, getRuntime } from "./runtime.js";
5
5
  const VALID_SERVICES = ["iMessage", "RCS", "SMS"];
6
6
  const plugin = {
@@ -56,6 +56,32 @@ const plugin = {
56
56
  };
57
57
  },
58
58
  });
59
+ api.registerTool({
60
+ name: "claw_messenger_create_group",
61
+ label: "Create iMessage/RCS/SMS Group",
62
+ description: "Create a new group chat and send the first message. Pass an array of E.164 phone numbers (at least 2) and the initial message text. Returns the chatId to use for future messages to this group.",
63
+ parameters: Type.Object({
64
+ to: Type.Array(Type.String(), {
65
+ description: "Array of E.164 phone numbers (e.g. [\"+12125551234\", \"+14155559876\"])",
66
+ minItems: 2,
67
+ }),
68
+ text: Type.String({ description: "The initial message to send to the group" }),
69
+ }),
70
+ async execute(_toolCallId, params) {
71
+ const { to, text } = params;
72
+ try {
73
+ const result = await createGroup(to, text);
74
+ return {
75
+ content: [{ type: "text", text: JSON.stringify(result) }],
76
+ };
77
+ }
78
+ catch (err) {
79
+ return {
80
+ content: [{ type: "text", text: JSON.stringify({ ok: false, error: err.message }) }],
81
+ };
82
+ }
83
+ },
84
+ });
59
85
  // -- Auto-Reply Commands --
60
86
  api.registerCommand({
61
87
  name: "cm-status",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emotion-machine/claw-messenger",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "iMessage, RCS & SMS channel plugin for OpenClaw — no phone or Mac Mini required",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",