From bc5f30fd06772319248fcef3dab556151323cdaa Mon Sep 17 00:00:00 2001 From: alma Date: Thu, 22 May 2025 18:34:41 +0200 Subject: [PATCH] W n8n --- lib/services/n8n-service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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), });