Skip to content

CRM

The CRM module is Lubb ERP's lead-and-opportunity pipeline: it captures enquiries (Facebook/Meta lead ads or hand-entered), tracks people as Contacts, and lets a rep work each one through to a quotation or a converted customer. It's used by sales/marketing staff on the sites where the CRM app is installed (the social/AI site, plus tc and mm), and it hands off into the Accounting module's Customers, Quotations and Sales Orders once a deal is ready to be priced. A closely related but separately-documented feature, the AI Call Center ("convai"), builds on the same Leads/Contacts data to run outbound qualification calls and campaigns — it's covered on its own page and only touched on briefly here.

What you can do

  • Maintain Contacts — people/companies, deduplicated by email/phone, each tagged with a source (Facebook, manual, import) and optionally linked to a Chatwoot conversation contact.
  • Work the Leads grid — a flat table plus a Kanban board (grouped by status: New/Unreachable/Quoted/Converted/Disqualified). Leads mostly arrive automatically from connected Meta lead-ad forms (daily sync, or an on-demand "Pull Meta Leads" toolbar button); the "New" button lets a rep add one by hand. Each lead is flagged Stale once it's sat open 3+ weeks.
  • Log Opportunities by hand — a second Kanban pipeline (same status vocabulary as Leads) for enquiries a rep enters directly rather than ones ingested from ads. Each opportunity links to exactly one party, picked from either an open Lead or an existing Customer, plus a value, source, callback date/time and notes.
  • Create a Quotation straight from a Lead — a row button opens the quotation form pre-filled with the lead's name/email/phone; saving it resolves (or creates) the matching Accounting Customer behind the scenes. The same combined Lead-or-Customer picker is offered on the Sales Order form.
  • Filter Leads by their originating Meta Campaign (or "Referrals" for manually-added ones).
  • Push selected/filtered leads into an email + SMS list, or hand them to an extension auto-dialler that rings the operator's own PBX extension and bridges them through each new lead in turn.
  • Configure how imported leads are categorised (rules mapping a source ad/adset/campaign/form to a category label) and, separately, how a lead's form answers map to catalogue items for automated quoting (Quote Item Mapping — used by the Quote Agent, see below).
  • Hand leads off to the AI Call Center: group selected leads into a new outbound calling campaign locally ("Create call center campaign"), or, on a site that doesn't host the call center itself, mirror the filtered leads across to the site that does ("Send to AI Call Center"). Campaigns, Campaign Targets (Deals) and their Kanban/qualifier-calling detail are documented on the AI Call Center page.

Common tasks

  1. Add a lead by hand Open Leads and click "New". Fill in name, email, phone and category — the row is stamped with a synthetic manual lead id and source = "manual" so it sits alongside Facebook-sourced leads, and lands in "New" status at the top of the list. A notification email fires for every lead created this way (not for ones bulk-imported by the sync).

  2. Pull in the latest Meta/Facebook leads From the Leads toolbar, click "Pull Meta Leads" to run the same pull the daily scheduler does on demand — it fetches submissions from every connected Meta lead-ad form for the tenant and lands new/updated rows here. (This differs from "Import campaign leads" on Campaign Targets, which imports one chosen Meta campaign/ad straight into the AI Call Center pipeline.)

  3. Turn a lead into a customer and a quotation On a Lead row, click "Create Quotation". The quotation form opens pre-seeded with the lead's contact details; only on Save does the system find-or-create the matching Accounting Customer (by email/phone) and build the Quotation against it — closing the modal without saving creates nothing.

  4. Log a manually-sourced opportunity Open Opportunities and add a new record. Pick a party (an open Lead or an existing Customer — exactly one, enforced on create), set the source (referral/inbound/outbound/website/partner/other), value and currency, and optionally a callback date/time and notes. Drag the card between board columns, or edit its Status field directly, to move it through New → Unreachable/Quoted → Converted/Disqualified.

  5. Work the Leads Kanban board Switch Leads to board view and drag a card between columns to change its status; each move is logged as a status-change activity. Opportunities has its own, separately-tracked board using the same status set.

  6. Group leads into an outbound calling campaign Select one or more leads and click "Create call center campaign" (or "Send to AI Call Center" if this site only holds the leads, not the call center app), name the campaign, and the selected leads are added as targets a qualifier agent can dial. See the AI Call Center page for what happens next (calling, BANT qualification, automated quote building/follow-up).

Data model

  • CrmContact (crm_contacts) — a deduplicated person/company (by email/phone), the anchor most other CRM rows point back to; optionally linked to a Chatwoot contact.
  • CrmLead (crm_leads) — one imported or hand-added lead; keeps its source ad/form/campaign provenance, a snapshot of name/email/phone/form answers, and a soft (non-FK) pointer to the Accounting Customer it converted into.
  • CrmOpportunity (crm_opportunities) — a manually-tracked enquiry linked to exactly one of a Lead or a (soft-referenced) Accounting Customer; carries its own value/source/status/callback rather than duplicating contact details.
  • CrmPipeline / CrmStage (crm_pipelines / crm_stages) — the ordered stage set a Deal moves through (seeded automatically, not freely managed here).
  • CrmActivity (crm_activities) — timeline entries (status/stage changes, notes, calls) against a deal, lead or contact.
  • CrmCategoryRule (crm_category_rules) — maps a source ad/adset/campaign/form to a category label, applied at import time.
  • CrmLeadFieldItemMap (crm_lead_field_item_map) — maps a lead's form answers to catalogue items (acc_item), so the Quote Agent can build a priced quotation without any guessing.
  • CrmCampaign / CrmDeal (crm_campaigns / crm_deals, shown here as "Campaign Targets") and the Quote Item Mapping grid belong to the AI Call Center (convai) app; the underlying tables live alongside the rest of the CRM schema but are documented on that separate page.

Relationships to other modules: a Lead or Opportunity resolves/creates an AccCustomer (Accounting) when a Quotation or Sales Order is raised against it, via a shared find-or-create-by-email/phone match — CRM never duplicates billing-party data, it only links to it. A Deal's qualifier outcome can auto-build a real AccQuotation (Accounting) through the Quote Agent. Contacts/Leads/Pipeline Stages rows are shared (copied, not moved) onto the portal site so the AI Call Center can resolve them there too. CrmContact.chatwoot_contact_id links a contact to its Chatwoot conversation thread.

Configuration & integrations

  • Meta (Facebook) lead ads — a per-tenant connected ad account/access token (managed elsewhere in the Social/Meta integration) is what "Pull Meta Leads" and the daily sync pull from; without one connected, the sync is a no-op.
  • Category Rules — admin-configured, evaluated most-specific-first (ad → adset → campaign → form) to label incoming leads; falls back to the lead form's name when nothing matches.
  • Quote Item Mapping — admin-configured, deterministic field/value-to-item rules the Quote Agent uses to turn a lead's form answers into real quotation line items; never inferred by a model.
  • Chatwoot — contacts auto-match (or can be manually linked) to a Chatwoot contact for a merged conversation timeline.
  • Email + SMS lists — the "Add to Email + SMS List" action hands leads to the separate bulk email (bulkemail.telecloud.co.za) and SMS list services, based on which contact info each lead has.
  • PBX / extension auto-dialler — "Start auto-dialler" rings the operator's own PBX extension and bridges them through new leads one at a time.
  • AI Call Center (convai) — Telephony (SIP) accounts and qualifier agents used for outbound calling, campaign management and the automated quote-and-follow-up flow; configuration for that is documented on its own page.

API reference

Contacts, Leads and Opportunities are generic config-driven grids, reachable through the standard grid endpoints (slug is crm-contacts, crm-leads or crm-opportunities):

  • GET /grid/{slug}/data — list rows (search/filter/sort/paginate)
  • POST /grid/{slug} — create a row
  • PUT /grid/{slug}/{row_id} — update a row
  • DELETE /grid/{slug}/{row_id} — soft-delete a row
  • GET /grid/{slug}/stats — the grid's stat cards (e.g. Leads: total/new/quoted/converted/called today/called this week)
  • GET /grid/{slug}/board and POST /grid/{slug}/board/move — Kanban read and drag-to-move (Leads/Opportunities move by status)
  • POST /grid/{slug}/action/{key} — grid buttons: e.g. create_call_center_campaign, send_to_ai_call_center, sync_meta_leads on Leads

A handful of bespoke endpoints under /crm back actions the grid buttons/forms call into rather than duplicating logic:

  • POST /crm/deals, POST /crm/deals/{id}/move, PATCH /crm/deals/{id} — create/move/update a Campaign Target (deal)
  • POST /crm/deals/{id}/qualify — place a live qualification call (AI Call Center)
  • POST /crm/deals/{id}/build-quote — build an AccQuotation from a deal's lead form answers
  • POST /crm/deals/{id}/reset-calls — clear a deal's logged call attempts
  • GET /crm/leads, GET /crm/contacts, GET /crm/stats — read-only listing/summary endpoints predating the grid engine
  • GET/POST/DELETE /crm/category-rules, POST /crm/recategorize — manage and re-apply lead categorisation rules
  • GET/PUT /crm/sync/config, POST /crm/sync/run — Meta lead-sync connection settings and manual trigger

The Campaigns and Campaign Targets (Deals) grids, and their /crm/campaign/* and /crm/ext-campaign/* calling-flow endpoints, belong to the AI Call Center feature and are detailed on its own page.

Lubb ERP Documentation