Files
conversation-layer/whatsapp-router/src/chatHandlers.ts

17 lines
536 B
TypeScript

import { helloWorldAgent } from './helloAgent';
import { WhatsAppMessage } from './types';
export type Handler = string | ((msg: WhatsAppMessage | string) => Promise<string>);
export const chatHandlers: Record<string, Handler> = {
'50498554225@c.us': helloWorldAgent,
// Add other mappings like:
// '50496210031@c.us': 'http://llm-agent:8000'
};
export function getHandler(chatId: string | undefined, defaultUrl?: string): Handler | undefined {
if (!chatId) return defaultUrl;
return chatHandlers[chatId] || defaultUrl;
}