Files
openclaw/extensions/bluebubbles/src/pairing.ts
2026-04-07 13:59:09 +01:00

38 lines
1009 B
TypeScript

import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
import type { OpenClawConfig } from "./runtime-api.js";
import { normalizeBlueBubblesHandle } from "./targets.js";
type SendBlueBubblesMessage = (
id: string,
message: string,
params: {
cfg: OpenClawConfig;
accountId?: string;
},
) => Promise<unknown>;
export function createBlueBubblesPairingText(sendMessageBlueBubbles: SendBlueBubblesMessage) {
return {
idLabel: "bluebubblesSenderId",
message: PAIRING_APPROVED_MESSAGE,
normalizeAllowEntry: createPairingPrefixStripper(/^bluebubbles:/i, normalizeBlueBubblesHandle),
notify: async ({
cfg,
id,
message,
accountId,
}: {
cfg: OpenClawConfig;
id: string;
message: string;
accountId?: string;
}) => {
await sendMessageBlueBubbles(id, message, {
cfg,
accountId,
});
},
};
}