Add Zalo channel adapter with webhook and send path
This commit is contained in:
@@ -635,6 +635,31 @@ describe('configSchema — feishu', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — zalo', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('accepts zalo config and defaults optional fields', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
zalo: {
|
||||
oa_access_token: 'oa-token',
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.zalo).toBeDefined();
|
||||
if (!result.zalo) {
|
||||
throw new Error('Expected zalo config');
|
||||
}
|
||||
expect(result.zalo.oa_access_token).toBe('oa-token');
|
||||
expect(result.zalo.allowed_user_ids).toEqual([]);
|
||||
expect(result.zalo.require_mention).toBe(true);
|
||||
expect(result.zalo.mention_name).toBe('flynn');
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — whatsapp', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
@@ -521,6 +521,15 @@ const feishuSchema = z.object({
|
||||
endpoint: z.string().url('Feishu endpoint must be a valid URL').optional(),
|
||||
}).optional();
|
||||
|
||||
const zaloSchema = z.object({
|
||||
oa_access_token: z.string().min(1, 'Zalo oa_access_token is required'),
|
||||
endpoint: z.string().url('Zalo endpoint must be a valid URL').optional(),
|
||||
webhook_token: z.string().optional(),
|
||||
allowed_user_ids: z.array(z.string()).default([]),
|
||||
require_mention: z.boolean().default(true),
|
||||
mention_name: z.string().default('flynn'),
|
||||
}).optional();
|
||||
|
||||
const browserSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
executable_path: z.string().optional(),
|
||||
@@ -702,6 +711,7 @@ export const configSchema = z.object({
|
||||
bluebubbles: bluebubblesSchema,
|
||||
line: lineSchema,
|
||||
feishu: feishuSchema,
|
||||
zalo: zaloSchema,
|
||||
server: serverSchema.default({}),
|
||||
models: modelsSchema,
|
||||
backends: backendsSchema.default({}),
|
||||
|
||||
Reference in New Issue
Block a user