diff --git a/lib/services/n8n-service.ts b/lib/services/n8n-service.ts index 6a0ff409..cc33ab1a 100644 --- a/lib/services/n8n-service.ts +++ b/lib/services/n8n-service.ts @@ -3,11 +3,13 @@ import { env } from '@/lib/env'; export class N8nService { private webhookUrl: string; private rollbackWebhookUrl: string; + private apiKey: string; constructor() { // Use consistent webhook URLs without -test suffix - this.webhookUrl = process.env.N8N_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook-test/mission-created'; - this.rollbackWebhookUrl = process.env.N8N_ROLLBACK_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook-test/mission-rollback'; + this.webhookUrl = process.env.N8N_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook/mission-created'; + this.rollbackWebhookUrl = process.env.N8N_ROLLBACK_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook/mission-rollback'; + this.apiKey = process.env.N8N_API_KEY || ''; } async triggerMissionCreation(data: any): Promise { @@ -21,6 +23,7 @@ export class N8nService { method: 'POST', headers: { 'Content-Type': 'application/json', + 'x-api-key': this.apiKey }, body: data }; @@ -30,6 +33,7 @@ export class N8nService { method: 'POST', headers: { 'Content-Type': 'application/json', + 'x-api-key': this.apiKey }, body: JSON.stringify(data), }); @@ -84,6 +88,7 @@ export class N8nService { method: 'POST', headers: { 'Content-Type': 'application/json', + 'x-api-key': this.apiKey }, body: JSON.stringify(data), });