Skip to main content

CRM Service

The CRM (Customer Relationship Management) service manages customer data, email campaigns, contact history, and customer segmentation for each tenant.

Architecture

  Tenant Frontend ──┐
Webshop Service ──┤──▶ CRM Backend (Laravel 12)
Webhook Service ──┘ │
├──▶ PostgreSQL (crm schema)
├──▶ Redis (cache, queued emails)
├──▶ RabbitMQ (customer events)
└──▶ SMTP (email delivery)

Key Features

Customer Management

  • Customer profiles with contact details
  • Purchase history aggregation from Webshop
  • Customer segmentation and tagging
  • Notes and interaction history

Email Campaigns

  • Campaign creation with template editor
  • Audience targeting via segments
  • Scheduled and immediate sending
  • Open/click tracking

Communication

  • Email templates with variable substitution
  • Automated transactional emails (order confirmation, shipping, etc.)
  • Customer notification preferences

API Endpoints

Base URL: https://{tenant}.vecton.hu/api/crm (production) | http://localhost:8012/api (dev)

Customers

MethodEndpointDescription
GET/customersList customers (paginated, searchable)
GET/customers/{id}Get customer details
POST/customersCreate customer
PUT/customers/{id}Update customer
GET/customers/{id}/ordersCustomer's order history
GET/customers/{id}/activityCustomer interaction log

Segments

MethodEndpointDescription
GET/segmentsList customer segments
POST/segmentsCreate segment with rules
GET/segments/{id}/customersCustomers in segment

Campaigns

MethodEndpointDescription
GET/campaignsList email campaigns
POST/campaignsCreate campaign
POST/campaigns/{id}/sendSend campaign
GET/campaigns/{id}/statsCampaign analytics

Events

EventTriggerConsumers
customer.createdNew customer registeredAnalytics, Webhook
customer.updatedCustomer data changedWebhook
campaign.sentEmail campaign sentAnalytics
email.openedEmail opened (tracking pixel)Analytics
email.clickedLink clicked in emailAnalytics

Database Schema

TableDescription
customersCustomer profiles
customer_addressesShipping/billing addresses
customer_tagsCustomer segmentation tags
segmentsSegment definitions with rules
campaignsEmail campaigns
campaign_recipientsCampaign target list
email_templatesReusable email templates
interactionsCustomer interaction log

Configuration

VariableDescriptionDefault
APP_URLService base URLhttp://localhost:8012
DB_SCHEMADatabase schemacrm
MAIL_MAILEREmail driversmtp
MAIL_FROM_ADDRESSDefault sender emailnoreply@vecton.hu

Development

cd tenant/tenant-backend-crm
composer install
php artisan migrate --seed
php artisan serve --port=8012