Developer Guide

Developer Guide

Step-by-step guide to integrating EnterCRM into your product — from installation to advanced automation workflows.

Quick Start Guide

Get up and running with EnterCRM in under 10 minutes. Follow these three steps:

1

Create your account and workspace

Go to entercrm.io and register. You'll be prompted to name your workspace. Each workspace is isolated with its own customers, segments, and campaigns.

2

Generate an API key

From your dashboard, navigate to Settings → API Keys → Generate Key. Your key starts with eck_ and should be stored securely in your environment variables.

3

Install the tracking snippet or connect your API

Add the JavaScript snippet to your website for browser-side tracking, or send events directly from your server using the REST API.

Installing the Tracking Snippet

The EnterCRM JavaScript snippet auto-tracks pageviews and provides a global EnterCRM object for custom events. Add it to the <head> of every page you want to track.

<!-- Add this to every page you want to track -->
<script>
  (function(e,n,t,r,c,r,m){
    e.EnterCRM = e.EnterCRM || {};
    e.EnterCRM.apiKey = 'eck_YOUR_API_KEY_HERE';
    var s = n.createElement(t);
    s.async = 1;
    s.src = 'https://cdn.entercrm.io/enter-track.js';
    n.head.appendChild(s);
  })(window, document, 'script');
</script>

Identifying customers

Call EnterCRM.identify() after a user logs in to associate events with a specific customer profile:

// After user login
EnterCRM.identify({
  email: 'user@example.com',
  name: 'Ana Kovač',
  created_at: '2025-06-01'
});

Tracking custom events

// Track any custom event
EnterCRM.track('purchase', {
  amount: 149.99,
  currency: 'EUR',
  product_id: 'prod_abc123',
  product_name: 'Premium Plan'
});

// Track a page view manually (auto-tracked by default)
EnterCRM.page({ url: window.location.href });

Authentication

EnterCRM uses two authentication methods depending on your use case:

Bearer Token

Used for user-authenticated requests from your application frontend or backend. Obtained via /auth/login.

API Key (eck_...)

Used for server-to-server integrations and the JavaScript tracking snippet. Pass via X-API-Key header.

# Obtain a Bearer token
curl -X POST https://api.entercrm.io/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@company.com", "password": "yourpassword"}'

# Response
{ "token": "eyJ0eXAiOiJKV1Qi...", "user": {...}, "tenant": {...} }

# Use it in subsequent requests
curl https://api.entercrm.io/v1/customers \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1Qi..."
Never expose your Bearer token or API key in client-side code. API keys should only be used in server environments or the tracking snippet (which is limited to event ingestion only).

Working with Customers

Customer profiles are the core entity in EnterCRM. Each customer has RFM scores, CLV metrics, event history, and segment memberships updated automatically.

Listing customers

curl https://api.entercrm.io/v1/customers?page=1&per_page=25 \
  -H "Authorization: Bearer <token>"

# Filter by segment
curl "https://api.entercrm.io/v1/customers?segment_id=1" \
  -H "Authorization: Bearer <token>"

# Search by name or email
curl "https://api.entercrm.io/v1/customers?search=ana" \
  -H "Authorization: Bearer <token>"

Creating a customer

curl -X POST https://api.entercrm.io/v1/customers \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marko Horvatić",
    "email": "marko@example.com",
    "phone": "+385921234567",
    "city": "Zagreb",
    "country": "HR"
  }'

Event Tracking

Events are the building blocks of customer intelligence in EnterCRM. Every event updates the customer's RFM scores and can trigger automations.

Server-side event tracking

# Track a purchase event
curl -X POST https://api.entercrm.io/v1/track/event \
  -H "X-API-Key: eck_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_email": "marko@example.com",
    "event": "purchase",
    "properties": {
      "amount": 299.99,
      "currency": "EUR",
      "order_id": "ord_0001",
      "items": [
        { "id": "prod_123", "name": "Enterprise Plan", "quantity": 1, "price": 299.99 }
      ]
    }
  }'

Standard event names

EventDescription
purchaseCustomer completed a purchase
pageviewCustomer viewed a page
signupCustomer created an account
loginCustomer logged in
add_to_cartCustomer added item to cart
checkout_startCustomer started checkout
subscriptionCustomer subscribed to a plan
refundCustomer requested a refund

Segmentation & RFM

EnterCRM uses RFM (Recency, Frequency, Monetary) analysis to automatically score and segment your customers. Scores are recalculated after each event.

R

Recency

How recently did the customer make a purchase? Scored 1–5 (5 = most recent).

F

Frequency

How often does the customer purchase? Scored 1–5 (5 = most frequent).

M

Monetary

How much has the customer spent in total? Scored 1–5 (5 = highest value).

The combined RFM score (3–15) determines the segment. EnterCRM maps scores to named segments like Champions (13–15), Loyal Customers (9–12), At Risk (5–8), and Lost (3–4).

CLV (Customer Lifetime Value) fields — clv_total, clv_predicted, clv_average_order, clv_order_count — are also computed automatically from event data and updated alongside RFM scores.

Creating segments via API

curl -X POST https://api.entercrm.io/v1/segments \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "High Value + Recent",
    "description": "Customers who spent over €500 and purchased in last 30 days",
    "color": "#6366f1",
    "filters": {
      "clv_total_min": 500,
      "last_purchase_days_max": 30
    }
  }'

Creating Campaigns

Campaigns target a customer segment with email, SMS, or ad messages. The workflow is: create → draft content → review → send or schedule.

Email

HTML email with subject line, from name, and template support.

SMS

Short text messages sent to customers with valid phone numbers.

Ad Campaign

Sync customer segments to ad platforms (coming soon).

# Create and immediately send an email campaign
curl -X POST https://api.entercrm.io/v1/campaigns \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Win-Back Offer",
    "type": "email",
    "segment_id": 3,
    "subject": "We miss you — here is 20% off",
    "body": "<p>Hi {{name}},</p><p>Use code BACK20 for 20% off your next order.</p>",
    "from_name": "EnterCRM Team",
    "from_email": "hello@yourcompany.com"
  }'

# Then send it
curl -X POST https://api.entercrm.io/v1/campaigns/12/send \
  -H "Authorization: Bearer <token>"

Building Automations

Automations are visual workflows triggered by customer events. Use the drag-and-drop builder in your dashboard or define them via the API.

Trigger

Starts the flow

Condition

Yes / No branching

Action

Send email / SMS

Delay

Wait before next step

# Create a welcome automation
curl -X POST https://api.entercrm.io/v1/automations \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Series",
    "trigger_type": "customer_created",
    "is_active": true
  }'

# Save the flow design
curl -X POST https://api.entercrm.io/v1/automations/1/design \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": [
      { "id": "t1", "type": "trigger", "data": { "label": "New Customer" }, "position": { "x": 250, "y": 0 } },
      { "id": "a1", "type": "action",  "data": { "label": "Send Welcome Email" }, "position": { "x": 250, "y": 120 } },
      { "id": "d1", "type": "delay",   "data": { "label": "Wait 3 Days" }, "position": { "x": 250, "y": 240 } },
      { "id": "c1", "type": "condition","data": { "label": "Made a Purchase?" }, "position": { "x": 250, "y": 360 } },
      { "id": "a2", "type": "action",  "data": { "label": "Send Reminder" }, "position": { "x": 80, "y": 480 } },
      { "id": "a3", "type": "action",  "data": { "label": "Send Thank You" }, "position": { "x": 420, "y": 480 } }
    ],
    "edges": [
      { "id": "e1", "source": "t1", "target": "a1" },
      { "id": "e2", "source": "a1", "target": "d1" },
      { "id": "e3", "source": "d1", "target": "c1" },
      { "id": "e4", "source": "c1", "target": "a2", "label": "No" },
      { "id": "e5", "source": "c1", "target": "a3", "label": "Yes" }
    ]
  }'

Webhooks

EnterCRM can POST real-time notifications to your server when certain events occur.

EventTrigger
customer.createdA new customer profile is created
customer.segment_enteredCustomer enters a segment
customer.segment_exitedCustomer leaves a segment
campaign.sentA campaign finishes sending
automation.triggeredAn automation workflow is triggered
// Example webhook payload
{
  "event": "customer.segment_entered",
  "timestamp": "2026-03-16T10:00:00Z",
  "data": {
    "customer_id": 42,
    "customer_email": "user@example.com",
    "segment_id": 1,
    "segment_name": "Champions"
  }
}

// Verify the webhook signature
const signature = req.headers['x-entercrm-signature'];
const computed = crypto.createHmac('sha256', WEBHOOK_SECRET)
  .update(JSON.stringify(req.body))
  .digest('hex');

if (signature !== computed) {
  return res.status(401).send('Invalid signature');
}

SDKs & Libraries

Official client libraries are in development. In the meantime, use the REST API directly or the JS snippet.

JavaScript / TypeScript

Coming Soon

PHP

Coming Soon

Python

Coming Soon
Have feedback on this guide? Found an error? Let us know. Full API details are in the API Reference.