W n8n
This commit is contained in:
parent
f2192b7856
commit
bc5f30fd06
@ -3,11 +3,13 @@ import { env } from '@/lib/env';
|
|||||||
export class N8nService {
|
export class N8nService {
|
||||||
private webhookUrl: string;
|
private webhookUrl: string;
|
||||||
private rollbackWebhookUrl: string;
|
private rollbackWebhookUrl: string;
|
||||||
|
private apiKey: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// Use consistent webhook URLs without -test suffix
|
// Use consistent webhook URLs without -test suffix
|
||||||
this.webhookUrl = process.env.N8N_WEBHOOK_URL || 'https://brain.slm-lab.net/webhook-test/mission-created';
|
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-test/mission-rollback';
|
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<any> {
|
async triggerMissionCreation(data: any): Promise<any> {
|
||||||
@ -21,6 +23,7 @@ export class N8nService {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'x-api-key': this.apiKey
|
||||||
},
|
},
|
||||||
body: data
|
body: data
|
||||||
};
|
};
|
||||||
@ -30,6 +33,7 @@ export class N8nService {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'x-api-key': this.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
@ -84,6 +88,7 @@ export class N8nService {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'x-api-key': this.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user