Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agents/openclaw/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ messaging_platforms:
- slack
- wechat
- whatsapp
- zalo

# ── Inference ───────────────────────────────────────────────────
inference:
Expand Down
23 changes: 23 additions & 0 deletions nemoclaw-blueprint/policies/presets/zalo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

preset:
name: zalo
description: "Zalo Bot API access (long-polling)"

network_policies:
zalo:
name: zalo
endpoints:
# Zalo Bot API. Long-polling (getUpdates) is GET; sending messages is POST.
# The bot.zaloplatforms.com portal is only used to create the bot, not at runtime.
- host: bot-api.zaloplatforms.com
port: 443
protocol: rest
enforcement: enforce
rules:
- allow: { method: GET, path: "/**" }
- allow: { method: POST, path: "/**" }
binaries:
- { path: /usr/local/bin/node }
- { path: /usr/bin/node }
1 change: 1 addition & 0 deletions src/lib/agent/defs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe("agent definitions", () => {
"slack",
"wechat",
"whatsapp",
"zalo",
]);
expect(openclaw.inferenceProviderOptions).toEqual([]);
// #5027: openclaw.json must be declared as a durable state file so
Expand Down
2 changes: 2 additions & 0 deletions src/lib/messaging-channel-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ describe("messaging channel config", () => {
"SLACK_ALLOWED_USERS",
"SLACK_ALLOWED_CHANNELS",
"WHATSAPP_ALLOWED_IDS",
"ZALO_ALLOWED_IDS",
"TELEGRAM_GROUP_POLICY",
"WECHAT_ACCOUNT_ID",
"WECHAT_BASE_URL",
"WECHAT_USER_ID",
"ZALO_GROUP_POLICY",
]);
});

Expand Down
3 changes: 3 additions & 0 deletions src/lib/messaging/channels/built-ins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ import { slackManifest } from "./slack/manifest";
import { telegramManifest } from "./telegram/manifest";
import { wechatManifest } from "./wechat/manifest";
import { whatsappManifest } from "./whatsapp/manifest";
import { zaloManifest } from "./zalo/manifest";

export { discordManifest } from "./discord/manifest";
export { slackManifest } from "./slack/manifest";
export { telegramManifest } from "./telegram/manifest";
export { wechatManifest } from "./wechat/manifest";
export { whatsappManifest } from "./whatsapp/manifest";
export { zaloManifest } from "./zalo/manifest";

export const BUILT_IN_CHANNEL_MANIFESTS = [
telegramManifest,
discordManifest,
wechatManifest,
slackManifest,
whatsappManifest,
zaloManifest,
] as const;

export function createBuiltInChannelManifestRegistry(): ChannelManifestRegistry {
Expand Down
55 changes: 55 additions & 0 deletions src/lib/messaging/channels/manifests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
telegramManifest,
wechatManifest,
whatsappManifest,
zaloManifest,
} from "./index";
import {
SLACK_SOCKET_MODE_GATEWAY_CONFLICT_HOOK_HANDLER_ID,
Expand Down Expand Up @@ -202,6 +203,7 @@ describe("built-in channel manifests", () => {
"wechat",
"slack",
"whatsapp",
"zalo",
]);
expect(registry.listAvailable({ agent: "hermes" }).map((manifest) => manifest.id)).toEqual([
"telegram",
Expand Down Expand Up @@ -238,6 +240,9 @@ describe("built-in channel manifests", () => {
"src/lib/messaging/channels/slack/hooks/socket-mode-gateway-status.ts",
"src/lib/messaging/channels/slack/hooks/validate-credentials.ts",
"src/lib/messaging/channels/whatsapp/manifest.ts",
"src/lib/messaging/channels/zalo/manifest.ts",
"src/lib/messaging/channels/zalo/hooks/index.ts",
"src/lib/messaging/channels/zalo/hooks/openclaw-bridge-health.ts",
"src/lib/messaging/hooks/common/config-prompt.ts",
"src/lib/messaging/hooks/common/token-paste.ts",
];
Expand Down Expand Up @@ -649,4 +654,54 @@ describe("built-in channel manifests", () => {
expect(JSON.stringify(whatsappManifest.runtime?.openclaw)).toContain("whatsapp-qr-compact");
expectOpenClawRuntimeVisibility(whatsappManifest, ["whatsapp"], ["whatsapp"]);
});

it("declares Zalo as an OpenClaw-only flat-render channel with allowlist config", () => {
const botToken = findInput(zaloManifest, "botToken");
const allowedIds = findInput(zaloManifest, "allowedIds");
const groupPolicy = findInput(zaloManifest, "groupPolicy");
expect(zaloManifest.supportedAgents).toEqual(["openclaw"]);
expect(botToken.envKey).toBe("ZALO_BOT_TOKEN");
expect(allowedIds.envKey).toBe("ZALO_ALLOWED_IDS");
expect(allowedIds.statePath).toBe("allowedIds.zalo");
expect(groupPolicy).toMatchObject({
kind: "config",
envKey: "ZALO_GROUP_POLICY",
statePath: "zaloConfig.groupPolicy",
defaultValue: "allowlist",
validValues: ["open", "allowlist", "disabled"],
});
expect(policyPresetNames(zaloManifest)).toEqual(["zalo"]);
expect(zaloManifest.credentials).toEqual([
{
id: "zaloBotToken",
sourceInput: "botToken",
providerName: "{sandboxName}-zalo-bridge",
providerEnvKey: "ZALO_BOT_TOKEN",
placeholder: "openshell:resolve:env:ZALO_BOT_TOKEN",
},
]);
// @openclaw/zalo rejects the shared accounts.default shape, so the OpenClaw
// render must stay a flat channels.zalo object.
expect(renderJson(zaloManifest)).toContain('"path":"channels.zalo"');
expect(renderJson(zaloManifest)).not.toContain('"accounts"');
expect(renderJson(zaloManifest)).toContain('"path":"plugins.entries.zalo"');
// OpenClaw-only: no Hermes render targets.
expect(zaloManifest.render.every((entry) => entry.agent === "openclaw")).toBe(true);
expect(zaloManifest.agentPackages).toContainEqual({
id: "openclawPluginPackage",
agent: "openclaw",
manager: "openclaw-plugin",
spec: "npm:@openclaw/zalo@{{openclaw.version}}",
pin: true,
required: true,
});
expectTokenPasteEnrollHook(zaloManifest, ["botToken"]);
expectConfigPromptEnrollHook(zaloManifest, ["allowedIds", "groupPolicy"]);
expectOpenClawBridgeHealthHook(
zaloManifest,
"zalo-openclaw-bridge-health",
"zalo.openclawBridgeHealth",
);
expectOpenClawRuntimeVisibility(zaloManifest, ["zalo"], ["zalo"]);
});
});
5 changes: 5 additions & 0 deletions src/lib/messaging/channels/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe("built-in messaging channel metadata", () => {
"wechat",
"slack",
"whatsapp",
"zalo",
]);
expect(listAvailableMessagingChannelIds({ agent: "hermes" })).toEqual([
"telegram",
Expand Down Expand Up @@ -78,6 +79,8 @@ describe("built-in messaging channel metadata", () => {
"SLACK_ALLOWED_USERS",
"SLACK_ALLOWED_CHANNELS",
"WHATSAPP_ALLOWED_IDS",
"ZALO_ALLOWED_IDS",
"ZALO_GROUP_POLICY",
]);
expect(getMessagingConfigEnvAliases()).toEqual({
DISCORD_SERVER_ID: ["DISCORD_SERVER_IDS"],
Expand Down Expand Up @@ -110,6 +113,7 @@ describe("built-in messaging channel metadata", () => {
"openclaw-weixin",
"slack",
"whatsapp",
"zalo",
]);
expect(
Object.fromEntries(
Expand All @@ -134,6 +138,7 @@ describe("built-in messaging channel metadata", () => {
wechat: "npm:@tencent-weixin/openclaw-weixin@2.4.3",
slack: "npm:@openclaw/slack@{{openclaw.version}}",
whatsapp: "npm:@openclaw/whatsapp@{{openclaw.version}}",
zalo: "npm:@openclaw/zalo@{{openclaw.version}}",
});
expect(listMessagingPackageInstallSpecs({ agent: "hermes" })).toEqual([]);
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/messaging/channels/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export function listMessagingPackageInstallSpecs(
}

function selectManifests(options: MessagingManifestMetadataOptions): ChannelManifest[] {
const manifests = options.manifests ?? BUILT_IN_CHANNEL_MANIFESTS;
const manifests: readonly ChannelManifest[] = options.manifests ?? BUILT_IN_CHANNEL_MANIFESTS;
const agent = options.agent;
const selected = agent
? manifests.filter((manifest) => manifest.supportedAgents.includes(agent))
Expand Down
2 changes: 2 additions & 0 deletions src/lib/messaging/channels/template-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import { resolveTelegramTemplateReference } from "./telegram/template-resolver";
import type { BuiltInRenderTemplateResolver } from "./template-resolver-utils";
import { resolveWechatTemplateReference } from "./wechat/template-resolver";
import { resolveWhatsappTemplateReference } from "./whatsapp/template-resolver";
import { resolveZaloTemplateReference } from "./zalo/template-resolver";

const BUILT_IN_TEMPLATE_REFERENCE_RESOLVERS: readonly BuiltInRenderTemplateResolver[] = [
resolveTelegramTemplateReference,
resolveDiscordTemplateReference,
resolveWechatTemplateReference,
resolveSlackTemplateReference,
resolveWhatsappTemplateReference,
resolveZaloTemplateReference,
];

export function createBuiltInRenderTemplateResolver(): BuiltInRenderTemplateResolver {
Expand Down
18 changes: 18 additions & 0 deletions src/lib/messaging/channels/zalo/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import type { MessagingHookRegistration } from "../../../hooks/types";
import type { OpenClawBridgeHealthHookOptions } from "../../openclaw-bridge-health";
import { createZaloOpenClawBridgeHealthHookRegistration } from "./openclaw-bridge-health";

export * from "./openclaw-bridge-health";

export interface ZaloHookOptions {
readonly openclawBridgeHealth?: OpenClawBridgeHealthHookOptions;
}

export function createZaloHookRegistrations(
options: ZaloHookOptions = {},
): readonly MessagingHookRegistration[] {
return [createZaloOpenClawBridgeHealthHookRegistration(options.openclawBridgeHealth)] as const;
}
23 changes: 23 additions & 0 deletions src/lib/messaging/channels/zalo/hooks/openclaw-bridge-health.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import {
createOpenClawBridgeHealthHookRegistration,
type OpenClawBridgeHealthHookOptions,
} from "../../openclaw-bridge-health";

export type { OpenClawBridgeHealthHookOptions } from "../../openclaw-bridge-health";

export const ZALO_OPENCLAW_BRIDGE_HEALTH_HOOK_HANDLER_ID = "zalo.openclawBridgeHealth";

export function createZaloOpenClawBridgeHealthHookRegistration(
options: OpenClawBridgeHealthHookOptions = {},
) {
return createOpenClawBridgeHealthHookRegistration(
{
channelId: "zalo",
handlerId: ZALO_OPENCLAW_BRIDGE_HEALTH_HOOK_HANDLER_ID,
},
options,
);
}
Loading