export interface N8NConfig { baseUrl?: string; apiKey?: string; webhookPath?: string; } export interface N8NWebhookPayload { event: string; data: Record; timestamp: string; source: string; } export interface N8NWorkflowNode { id: string; name: string; type: string; position: [number, number]; parameters: Record; credentials?: Record; } export interface N8NWorkflowConnection { node: string; type: string; index: number; } export interface N8NWorkflow { name: string; nodes: N8NWorkflowNode[]; connections: Record; settings?: Record; } /** * N8N Integration class */ export declare class N8NIntegration { private config; constructor(config?: N8NConfig); /** * Trigger a webhook */ triggerWebhook(webhookId: string, payload: Record): Promise<{ success: boolean; response?: any; error?: string; }>; /** * Create a webhook payload for agent events */ createAgentEventPayload(event: string, agentId: string, data: Record): N8NWebhookPayload; /** * Export PraisonAI workflow to n8n format */ exportWorkflow(name: string, steps: Array<{ name: string; type: 'agent' | 'tool' | 'condition'; config?: Record; }>): N8NWorkflow; /** * Map PraisonAI step type to n8n node type */ private mapStepTypeToN8N; /** * Map step parameters to n8n format */ private mapStepParameters; /** * Generate n8n workflow JSON string */ exportWorkflowJSON(name: string, steps: Array<{ name: string; type: 'agent' | 'tool' | 'condition'; config?: Record; }>): string; /** * Import n8n workflow and convert to PraisonAI format */ importWorkflow(n8nWorkflow: N8NWorkflow): Array<{ name: string; type: string; config: Record; }>; /** * Map n8n node type to PraisonAI step type */ private mapN8NTypeToStep; /** * Create a webhook listener (for local development). Binds 127.0.0.1 by * default; a non-loopback `host` requires `token`, which every request must * send as `Authorization: Bearer ` or `X-Auth-Token`. */ createWebhookListener(port: number, handler: (payload: N8NWebhookPayload) => Promise, options?: { host?: string; token?: string; }): Promise<{ close: () => void; }>; } /** * Create an n8n integration instance */ export declare function createN8NIntegration(config?: N8NConfig): N8NIntegration; /** * Quick function to trigger an n8n webhook */ export declare function triggerN8NWebhook(webhookId: string, payload: Record, config?: N8NConfig): Promise<{ success: boolean; response?: any; error?: string; }>;