first commit
Some checks failed
Build and Deploy / build-and-push (push) Failing after 4m14s

This commit is contained in:
Cauê Faleiros
2026-04-09 09:45:02 -03:00
commit c687fd2bd1
12 changed files with 305 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import axios from 'axios';
export const sendToN8n = async (data: any): Promise<void> => {
const n8nWebhookUrl = process.env.N8N_WEBHOOK_URL;
if (!n8nWebhookUrl) {
console.error('N8N_WEBHOOK_URL is not defined in environment variables.');
return;
}
try {
console.log(`Forwarding payload to n8n at ${n8nWebhookUrl}...`);
const response = await axios.post(n8nWebhookUrl, data, {
headers: {
'Content-Type': 'application/json'
}
});
console.log(`Successfully forwarded to n8n. Status: ${response.status}`);
} catch (error: any) {
console.error('Failed to forward payload to n8n.', error.message);
if (error.response) {
console.error('n8n Response:', error.response.status, error.response.data);
}
}
};