Build a Laravel Ticketing System with n8n: Full Guide

Build a Laravel Ticketing System with n8n: Full Guide

Valerie Gaudette
Valerie Gaudette
February 20, 2026
Last updated : February 21, 2026
February 20, 2026

Support ticketing systems are a core piece of customer service infrastructure. Most businesses default to SaaS platforms like Zendesk or Freshdesk, which work well until you need something they don't offer. Custom routing rules, specific integrations with internal tools, or compliance requirements can push you toward building your own system.

Laravel paired with n8n creates a strong foundation for custom ticketing workflows. Laravel handles the application logic, user management, and data storage. n8n manages the automation layer, routing tickets, sending notifications, and connecting to external services. Together, they give you full control without the recurring per-seat costs of commercial platforms. This Laravel n8n integration is particularly appealing for teams seeking a self-hosted ticketing system as a Zendesk alternative open source solution.

This guide covers how to architect and implement a ticketing system using this stack, with practical code examples and workflow patterns. Whether you want to build custom ticketing system Laravel solutions from scratch or enhance existing workflows, the patterns here apply.

Prerequisites

Before you start building, make sure you have:

Technical Requirements:

  • Laravel 10 or 11 installed with a working development environment
  • n8n instance (self-hosted via Docker or n8n Cloud account)
  • MySQL 8.0 or PostgreSQL 15 database
  • Redis for queues and caching
  • Basic familiarity with Laravel's HTTP client and event system
  • Understanding of webhooks and REST APIs

Infrastructure for Production:

  • Server or container platform for Laravel (Laravel Forge, Vapor, or VPS)
  • Docker environment for n8n (recommended for self-hosting)
  • Reverse proxy setup (NGINX) if self-hosting both

Understanding the Architecture

The architecture splits responsibilities clearly. Laravel serves as your primary application, handling everything users interact with directly. n8n operates as your automation backbone, responding to events and executing workflows. This Laravel ticketing system architecture keeps concerns cleanly separated.

Laravel handles:

  • User authentication and authorization
  • Ticket CRUD operations
  • Database management (tickets, users, categories, SLAs)
  • API endpoints that n8n consumes
  • Real-time UI updates via broadcasting
  • File attachments and storage

n8n handles:

  • Ticket routing based on rules or AI classification
  • SLA monitoring and escalation triggers
  • Multi-channel notifications (email, Slack, SMS, Teams)
  • External system integration (CRM, billing platforms)
  • Scheduled tasks like report generation
  • AI-powered ticket analysis when needed

Our experience shows that keeping this separation clean prevents the common pitfall of building complex automation logic directly into your Laravel codebase. When business rules change (and they always do), adjusting a visual workflow in n8n is faster than modifying and deploying PHP code.

Integration Methods

Webhooks (Most Common)

This is the primary integration pattern. Laravel sends HTTP POST requests to n8n webhook endpoints when events occur. n8n workflows can also call back to Laravel's API. This Laravel webhook automation approach provides real-time responsiveness for ticket processing.

Laravel Event → HTTP POST → n8n Webhook Trigger → Workflow Execution
n8n Workflow → HTTP Request Node → Laravel API Endpoints

Queue-Based Integration

For high-volume systems, you can use message queues as an intermediary. Laravel pushes messages to Redis or SQS, and n8n processes them. This decouples the systems and handles traffic spikes more gracefully. This queue-based webhook integration pattern ensures reliability under load.

Direct Database Access

n8n can connect directly to your Laravel database using MySQL or PostgreSQL nodes. This works for simple read operations or reporting workflows, but write operations should go through Laravel's API to maintain data integrity.

API-First Pattern

Laravel exposes RESTful endpoints for all ticket operations. n8n acts purely as an orchestration layer, pulling and pushing data through the API. This is the cleanest approach for teams that want strict separation.

Step-by-Step Implementation

Step 1: Set Up Your Laravel Ticket Model and API

Create your ticket model with the fields you need:

// database/migrations/create_tickets_table.php
Schema::create('tickets', function (Blueprint $table) {
    $table->id();
    $table->foreignId('user_id')->constrained();
    $table->foreignId('assigned_to')->nullable()->constrained('users');
    $table->string('subject');
    $table->text('description');
    $table->enum('status', ['open', 'pending', 'resolved', 'closed'])->default('open');
    $table->enum('priority', ['low', 'medium', 'high', 'urgent'])->default('medium');
    $table->string('category')->nullable();
    $table->timestamp('due_at')->nullable();
    $table->timestamps();
});

Set up API routes for n8n to consume:

// routes/api.php
Route::middleware('auth:sanctum')->group(function () {
    Route::apiResource('tickets', TicketController::class);
    Route::post('tickets/{ticket}/assign', [TicketController::class, 'assign']);
    Route::post('tickets/{ticket}/escalate', [TicketController::class, 'escalate']);
});

This Laravel support ticket API follows RESTful conventions that n8n consumes seamlessly. The auth:sanctum middleware provides Laravel Sanctum API authentication for secure endpoint access.

Step 2: Create the Webhook Trigger in Laravel

When a ticket is created, fire an event that notifies n8n:

// app/Events/TicketCreated.php
class TicketCreated
{
    use Dispatchable, SerializesModels;

    public function __construct(public Ticket $ticket) {}
}

// app/Listeners/NotifyN8nOfTicket.php
class NotifyN8nOfTicket
{
    public function handle(TicketCreated $event): void
    {
        Http::withToken(config('services.n8n.api_token'))
            ->post(config('services.n8n.webhook_url'), [
                'event' => 'ticket.created',
                'ticket' => $event->ticket->load('user')->toArray(),
                'timestamp' => now()->toIso8601String(),
            ]);
    }
}

Register the listener in your EventServiceProvider:

protected $listen = [
    TicketCreated::class => [
        NotifyN8nOfTicket::class,
    ],
];

This Laravel event webhook pattern cleanly separates your domain logic from external integration concerns.

Step 3: Build the n8n Workflow for Ticket Routing

In n8n, create a new workflow with these nodes. This n8n ticket routing workflow demonstrates visual automation in action:

  • Webhook Trigger – Receives the ticket.created event from Laravel
  • Switch Node – Routes based on ticket category or keywords
  • HTTP Request Node – Calls back to Laravel to assign the ticket
  • Slack/Email Node – Notifies the assigned team

Here's a simplified workflow structure:

{
  "nodes": [
    {
      "name": "Ticket Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "ticket-created",
        "httpMethod": "POST"
      }
    },
    {
      "name": "Route by Category",
      "type": "n8n-nodes-base.switch",
      "parameters": {
        "rules": [
          {
            "conditions": {
              "string": [{"value1": "={{$json.ticket.category}}", "value2": "billing"}]
            },
            "output": 0
          },
          {
            "conditions": {
              "string": [{"value1": "={{$json.ticket.category}}", "value2": "technical"}]
            },
            "output": 1
          }
        ]
      }
    },
    {
      "name": "Assign to Billing Team",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "https://your-app.com/api/tickets/{{$json.ticket.id}}/assign",
        "method": "POST",
        "body": {"team": "billing"}
      }
    }
  ]
}

This n8n workflow tutorial pattern can be extended with additional conditions and integrations as your needs evolve.

Step 4: Add SLA Monitoring

Implementing ticket SLA monitoring automation is essential for maintaining service level commitments. Create a scheduled n8n workflow that checks for overdue tickets:

  • Schedule Trigger – Runs every 15 minutes
  • HTTP Request – Fetches tickets approaching SLA breach
  • Loop Over Items – Process each ticket
  • IF Node – Check escalation level
  • HTTP Request – Escalate ticket in Laravel
  • Email/Slack – Notify managers

Your Laravel API endpoint for this:

// In TicketController
public function approaching_breach(Request $request)
{
    return Ticket::where('status', '!=', 'closed')
        ->where('due_at', '<=', now()->addHour())
        ->where('due_at', '>', now())
        ->with('assignedTo')
        ->get();
}

Working with our customers taught us that SLA workflows need careful tuning. Start with longer check intervals (30 minutes) and tighten them once you understand your ticket volume patterns. This ticket escalation workflow ensures urgent issues receive appropriate attention.

Step 5: Implement AI Classification (Optional)

If you want automatic ticket categorization, add an OpenAI node to your n8n workflow. This AI ticket classification OpenAI integration can significantly reduce manual categorization work:

{
  "name": "Classify Ticket",
  "type": "@n8n/n8n-nodes-langchain.openAi",
  "parameters": {
    "model": "gpt-4",
    "prompt": "Classify this support ticket into one of these categories: billing, technical, account, general.\n\nTicket: {{$json.ticket.subject}} - {{$json.ticket.description}}\n\nRespond with only the category name."
  }
}

The classification result feeds into your routing logic, replacing or supplementing manual category selection.

Common Mistakes to Avoid

1. Unsecured Webhook Endpoints

Never expose your n8n webhook URLs without authentication. Anyone who discovers the URL could inject fake ticket events.

We recommend using signed payloads. Laravel can sign outgoing requests, and n8n can verify the signature before processing:

// In your listener
$payload = ['event' => 'ticket.created', 'ticket' => $ticket->toArray()];
$signature = hash_hmac('sha256', json_encode($payload), config('services.n8n.secret'));

Http::withHeaders(['X-Signature' => $signature])
    ->post(config('services.n8n.webhook_url'), $payload);

2. Synchronous Webhook Calls Blocking Requests

If n8n is slow to respond, your Laravel request hangs. Always dispatch webhook calls to a queue:

// Use a queued job instead of direct HTTP call
dispatch(new NotifyN8nJob($ticket));

3. Missing Error Handling in Workflows

n8n workflows should handle failures gracefully. Add error workflows to catch and log failures, otherwise you'll have silent breakdowns in your automation.

4. Over-Complicated Initial Workflows

Start simple. A basic routing workflow is more valuable than an over-engineered system that's hard to maintain. You can add complexity incrementally as you understand your actual needs.

5. Ignoring Rate Limits

If you have high ticket volume, both your Laravel API and any external services (Slack, email providers) have rate limits. Build in delays and batching for notification workflows.

Testing and Verification

1. Verify Webhook Connectivity

Use n8n's built-in test feature. Click "Listen for Test Event" on your webhook node, then create a test ticket in Laravel. You should see the payload appear in n8n.

2. Test Each Workflow Path

Create tickets with different categories or priorities to ensure your routing logic handles each case. Check that the correct assignments and notifications occur.

3. Monitor Queue Processing

If using Laravel Horizon, watch for failed jobs in the dashboard. Webhook failures should be logged and retryable.

4. Validate API Responses

n8n should handle non-200 responses from Laravel. Test error scenarios by temporarily returning errors from your API endpoints.

5. End-to-End Testing

Create a test ticket and trace it through the entire flow:

  • Ticket created in Laravel
  • Webhook fires to n8n
  • n8n workflow processes and routes
  • Assignment updated in Laravel
  • Notifications sent to correct channels

Log timestamps at each stage to identify bottlenecks.

Wrapping Up

Building a ticketing system with Laravel and n8n gives you the flexibility that commercial SaaS platforms can't match. When you build custom ticketing system Laravel solutions, you gain complete control over every aspect of your support infrastructure. Laravel provides a solid foundation for your application logic and data management, while n8n handles the automation layer through visual workflows. The webhook-based architecture keeps both systems decoupled and maintainable.

The key pieces to get right are secure webhook communication, proper queue handling for reliability, and starting with simple workflows before adding complexity. AI classification and other advanced features can come later once your core system is stable.

This approach works best for teams that need custom business logic, have specific compliance requirements, or want to avoid escalating per-seat licensing costs. The tradeoff is development time upfront and ongoing infrastructure responsibility.

If you're considering building a custom ticketing system with Laravel and n8n, or need help integrating automation workflows into an existing application, we can help you design an architecture that fits your support team's actual needs and scales with your business.

Share this article