Skip to content

Brekz Backend API

Terug naar Brekz

API & Data Layer

Centrale Laravel-backend die als brug dient tussen Brekz PrestaShop en de rest van het Brekz-platform. Levert product- en klantdata aan de Brekz Website en verzorgt de technische integratie met Front voor de helpdesk.

  • Bridge tussen PrestaShop en Laravel
  • Product- en klantdata API voor de website
  • Key-value store voor routing/URL-resolving
  • Front helpdesk integratie (customer/order lookup, webhooks)
Aspect Details
Type API
Platform Laravel
Repository brekz-group/brekz-shop-backend
Lokaal pad ~/Projects/Brekz/brekz-shop-backend

Omgevingen

Omgevingscode: BRBA Prod

Hosting

NOG AAN TE VULLEN - URL, Server Management Tool (Forge of Ploi), server en site-link.

Front Helpdesk Integratie

Front integreert met de Brekz Backend API via drie API endpoints voor real-time customer en order lookup. Zie Brekz Front Helpdesk voor de documentatie van Front als externe tool.

Customer Lookup

GET /api/front/customers?email={customer_email}

Beschrijving: Haalt klantgegevens op basis van email adres.

Response: JSON array met klantinformatie (naam, adres, telefoonnummer, etc.)

Gebruik: Front gebruikt dit wanneer een support agent een customer opzoekt op basis van email.

Order Lookup

GET /api/front/orders/{order_id}

Beschrijving: Haalt orderdetails op basis van order ID.

Response: JSON met order status, items, totaal prijs, verzendadres, etc.

Gebruik: Support agents kunnen snel order status en details zien in Front.

Comment toevoegen

POST /api/front/orders/{order_id}/comment

Body:

{
  "comment": "Beschrijving van het probleem",
  "email": "support@brekz.nl"  // Optional, default: f.kwakkenbos@flooris.nl
}

Beschrijving: Voegt een comment toe aan een order in PrestaShop op basis van Front conversations.

Webhooks

Front stuurt webhooks terug naar de Backend API wanneer events plaatsvinden in conversations:

Webhook Endpoint

POST /api/front/customer/webhook

Security: Alle webhooks zijn beveiligd met HMAC-SHA256 signatures. Headers: - x-front-signature - HMAC-SHA256 signature - x-front-request-timestamp - Request timestamp - x-front-challenge - Challenge string voor validatie

Events: - Conversation created - Message added - Customer updated - Tags changed

Webhook Processing: 1. Signature validatie (FrontCustomerController::webhook()) 2. Event dispatching (FrontWebhookEvent) 3. Database logging (FrontWebhookSaveDatabaseListener) 4. Incoming message processing (FrontWebhookIncomingListener)

Cronjobs & Commands

Weekly Webhook Summary

Schedule: Elke week (via console.php)

Schedule::command(FixCurrentFrontLogsCommand::class, ['--this-week'])->weekly();

Beschrijving: Verwerkt en summarisert alle webhook logs van de afgelopen week. Dit helpt bij het opsporen van eventuele integratieproblemen.

Contact Update Command

Commando:

php artisan front:update-contact {webhook_id?} {--from-date=} {--to-date=}

Beschrijving: Herpush webhook updates naar Front. Handig voor het resynchroniseren van customer contactgegevens na updates.

Opties: - webhook_id - Specifieke webhook (optional) - --from-date - Startdatum (optional) - --to-date - Einddatum (optional, default: vandaag)

Voorbeeld:

# Resync webhook met ID 123
php artisan front:update-contact 123

# Resync alle webhooks van gister
php artisan front:update-contact --from-date=2026-08-04 --to-date=2026-08-04

Health Checks

Endpoint: /health

De Brekz Backend API voert elke minuut health checks uit:

Schedule::command(RunHealthChecksCommand::class)->everyMinute();

Dit monitort: - Backend API availability - Database connectivity - Third-party service integrations (o.a. Front)

Health check resultaten zijn beschikbaar op https://brekz-backend.production/health

Database Tables

FrontWebhookSummary

Slaat weekly summaries op van Front webhook activity:

  • week_start_date - Start van de week
  • total_messages - Totaal aantal messages
  • total_conversations - Totaal aantal conversations
  • created_at - Timestamp

Webhook

Slaat alle incoming webhooks op:

  • request_body - Raw webhook payload
  • headers - Webhook headers (voor signature validatie)
  • created_at - Timestamp

Configuratie

Front integratie wordt geconfigureerd via environment variables in .env:

FRONT_WEBHOOK_SIGNING_KEY=<signing_key_from_front>
FRONT_API_TOKEN=<api_token_from_front>

Front Credentials

Login gegevens voor Front zijn beschikbaar in 1Password: Brekz - Front (Vault: Brekz)

Gerelateerde Documentatie

Brekz Shop Backend Repo Brekz Front Helpdesk (externe tool) Front API Documentation