Back to Blog
Automation2 min read

Automating Operations with n8n Webhooks

... Views
Automating Operations with n8n Webhooks

When a client initiates a handshake via the Terminal on our Contact page, the payload isn't just sent to an email API. It's routed into a self-hosted n8n instance.

Why n8n?

n8n is a fair-code licensed workflow automation tool. By hosting it on our Coolify server, we bypass the execution limits of Zapier or Make.com.

The Next.js Server Action

We built a secure bridge between the React frontend and the n8n webhook using a Next.js Server Action. This hides the Webhook URL from the client browser and allows us to append secure server-side metadata (like timestamps and origin IPs).

'use server'
 
export async function submitContactMessage(payload: { name: string; email: string; message: string }) {
  const webhookUrl = process.env.N8N_WEBHOOK_URL;
  
  const response = await fetch(webhookUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      ...payload,
      source: 'luxima_portfolio_terminal',
      timestamp: new Date().toISOString()
    }),
  });
 
  return { success: response.ok };
}

The n8n Workflow

Once n8n receives the webhook, the workflow:

  1. Parses the JSON payload.
  2. Filters out spam using a basic regex node.
  3. Routes the message to a dedicated Slack channel.
  4. Automatically adds the lead to our self-hosted CRM database.

By keeping the automation engine on the same Coolify network, latency between the Next.js app and the webhook is practically zero.

Have thoughts on this protocol?

I'm always open to discussing new architectural patterns or ecosystem strategies. Let's start a technical conversation.

System_Online
Local_Timestamp