Add Zalo channel adapter with webhook and send path

This commit is contained in:
William Valentin
2026-02-16 13:11:51 -08:00
parent 891ccb696e
commit 8bed99c770
16 changed files with 491 additions and 6 deletions
+36
View File
@@ -25,6 +25,7 @@ describe('registerChannels', () => {
setBlueBubblesHandler: vi.fn(),
setLineHandler: vi.fn(),
setFeishuHandler: vi.fn(),
setZaloHandler: vi.fn(),
};
registerChannels({
@@ -59,6 +60,7 @@ describe('registerChannels', () => {
setBlueBubblesHandler: vi.fn(),
setLineHandler: vi.fn(),
setFeishuHandler: vi.fn(),
setZaloHandler: vi.fn(),
};
registerChannels({
@@ -106,4 +108,38 @@ describe('registerChannels', () => {
expect(names).toContain('feishu');
expect(gateway.setFeishuHandler).toHaveBeenCalledTimes(1);
});
it('registers Zalo adapter when configured', () => {
const config = configSchema.parse({
telegram: { bot_token: 'test-token', allowed_chat_ids: [1] },
models: { default: { provider: 'anthropic', model: 'claude-3' } },
zalo: {
oa_access_token: 'oa-token',
allowed_user_ids: ['uid-1'],
},
});
const channelRegistry = new ChannelRegistry();
const gateway = {
setWebhookHandler: vi.fn(),
setGmailHandler: vi.fn(),
setTeamsHandler: vi.fn(),
setGoogleChatHandler: vi.fn(),
setBlueBubblesHandler: vi.fn(),
setLineHandler: vi.fn(),
setFeishuHandler: vi.fn(),
setZaloHandler: vi.fn(),
};
registerChannels({
config,
channelRegistry,
hookEngine: new HookEngine(config.hooks),
gateway: gateway as unknown as Parameters<typeof registerChannels>[0]['gateway'],
});
const names = channelRegistry.list().map((adapter) => adapter.name);
expect(names).toContain('zalo');
expect(gateway.setZaloHandler).toHaveBeenCalledTimes(1);
});
});