lcrm-search

Original🇨🇳 Chinese
Translated
4 scripts

Retrieve yourself, customers, customer business records, customer opportunities, customer contacts, leads, opportunities, tags, and users, and initiate queries via scripts.

7installs
Added on

NPX Install

npx skill4agent add r-earth-or/lcrm_skills lcrm-search

SKILL.md Content (Chinese)

View Translation Comparison →

Scenario 1: Retrieval

Goal

Enable sales to quickly retrieve:
  • Yourself (current logged-in identity)
  • Customers (including public pool customers)
  • Business records (query by customer, lead, opportunity, recorder)
  • Customer opportunities
  • Customer contacts
  • Leads (including public pool leads)
  • Opportunities
  • Tags
  • Users
  • Notifications (active notifications, historical notifications)
  • Presales itineraries (filtered by time period)

Script Entry

  • Main script:
    node scripts/search.mjs <action> [options]
  • General script:
    node scripts/request.mjs ...
  • Environment variables:
    • Required:
      LCRM_API_KEY
    • Optional:
      LCRM_BASE_URL
      (default
      https://crm.langcore.net
      )

Execution Flow

  1. Determine the object the user wants to retrieve (yourself/customers/leads/opportunities/tags/users/customer-related data).
  2. If the object is yourself, use the
    me
    action.
  3. If the object is a user, prefer using the
    users
    or
    sales-presales-users
    action.
  4. If the object is a tag, use the
    tags
    action.
  5. Prioritize invoking the corresponding action in
    search.mjs
    to initiate retrieval.
  6. If multiple results are hit and the unique object cannot be determined, let the user select first before proceeding.
  7. When returning results, provide core fields first, then suggest parameters for further narrowing down the scope.

Retrieval Enumeration Dictionary

Customer filtering enumeration (
GET /api/customers
):
  • customerType[]
    :
    Direct Customer
    ,
    Partner
  • customerSource[]
    :
    Self-developed Lead
    ,
    Company-assigned
  • customerStatus[]
    :
    Potential Customer
    ,
    Follow-up Customer
    ,
    Business Opportunity Customer
    ,
    Cooperative Customer
    ,
    Invalid Customer
  • region[]
    :
    Shanghai
    ,
    Beijing
    ,
    South China
    ,
    East China
    ,
    Overseas
    ,
    Other
Opportunity filtering enumeration (
GET /api/opportunities/list
):
  • status
    :
    Demand Guidance
    ,
    Customer Project Initiation
    ,
    Customer Selection
    ,
    Customer Closed
    ,
    Opportunity Failed
Lead filtering enumeration (
GET /api/leads
):
  • status[]
    :
    Pending Processing
    ,
    Followed Up
    ,
    Converted
  • classification[]
    :
    Company
    ,
    Marketing
    ,
    Sales
  • source[]
    or
    source
    :
    Official Channel
    ,
    Self-hosted Event
    ,
    Third-party Event
    ,
    Marketing List
    ,
    Acquaintance Referral
    ,
    Ecosystem Partner
    ,
    Sales Self-developed
  • tags[]
    : Lead tag names (supports multiple values, matches by "contains all tags")
  • Note:
    tags[]
    is currently only used for lead retrieval, not applicable to customer and opportunity retrieval
Business record field enumeration (for result interpretation and associated queries):
  • followUpType
    :
    WeChat
    ,
    Phone Call
    ,
    Online Meeting
    ,
    Email
    ,
    On-site Visit
    ,
    Business Event
    ,
    Other
Tag filtering enumeration (
GET /api/tags
):
  • category
    : The current system mainly uses
    LEAD
  • Note: Currently, only leads use the tag field in business; customers and opportunities have no tag field yet

API Mapping

1) Search Yourself (Current Identity)

  • Script:
    • node scripts/search.mjs me
  • API:
    • GET /api/auth/me

2) Retrieve Customers

  • Script:
    • node scripts/search.mjs customers --company-name "<customer name>" --limit 5
    • Complex filtering:
      node scripts/search.mjs customers --query 'customerStatus[]=Follow-up Customer' --query 'region[]=East China'
    • Query public pool customers: First get the public pool user ID, then query
      node scripts/search.mjs customers --query 'followUpSalesId[]=<public pool user ID>'
    • Query my customers:
      node scripts/search.mjs customers --query 'followUpSalesId[]=<my user ID>'

3) Retrieve Business Records

Supports multiple query methods:
  • Query by customer:
    node scripts/search.mjs customer-business-records --customer-id "<customerId>"
  • Query by recorder:
    node scripts/search.mjs business-records --recorder-id "<userId>"
  • Query by recorder and time:
    node scripts/search.mjs business-records --recorder-id "<userId>" --start-date 2026-02-12 --end-date 2026-02-12
  • Query by lead:
    node scripts/search.mjs business-records --lead-id "<leadId>"
  • Query by opportunity:
    node scripts/search.mjs business-records --opportunity-id "<opportunityId>"
  • Combined query:
    node scripts/search.mjs business-records --customer-id "<id>" --query limit=10
  • Time range query:
    node scripts/search.mjs business-records --start-date 2026-02-01 --end-date 2026-02-28
Note: If you need to find the customer first before querying records, use:
node scripts/search.mjs customers --company-name "<customer name>" --limit 5

4) Retrieve Customer Opportunities

Choose one of the two:
  • node scripts/search.mjs customer-opportunities --customer-id "<customerId>"
  • node scripts/search.mjs customer-opportunities --customer-name "<customer name>"

5) Retrieve Customer Contacts

  • node scripts/search.mjs customer-contacts --customer-id "<customerId>"

6) Retrieve Leads

  • node scripts/search.mjs leads --query keyword="<keyword>" --query limit=20
  • Complex filtering examples:
    • node scripts/search.mjs leads --query 'status[]=Followed Up' --query 'classification[]=Sales' --query mine=true
    • node scripts/search.mjs leads --query 'tags[]=Key Customer' --query 'tags[]=AI'
  • Query public pool leads:
    node scripts/search.mjs leads --query publicOnly=true
  • Query my leads:
    node scripts/search.mjs leads --query mine=true

7) Retrieve Opportunities

  • node scripts/search.mjs opportunities --query customerName="<customer name>" --query status=Demand Guidance,Customer Project Initiation
  • Amount and date filtering examples:
    • node scripts/search.mjs opportunities --query minAmount=100000 --query maxAmount=500000 --query startDate=2026-02-01 --query endDate=2026-03-31

8) Retrieve Users

  • User retrieval (accessible to all authenticated users, supports keywords):
    • node scripts/search.mjs users --search "<name or email keyword>" --limit 20
  • Directly query sales/presales users:
    • node scripts/search.mjs sales-presales-users --search "<name or email keyword>"

9) Retrieve Tags

  • Query all tags:
    • node scripts/search.mjs tags
  • Query tags by category:
    • node scripts/search.mjs tags --category LEAD
  • Filter tags by keyword (name/description/category):
    • node scripts/search.mjs tags --category LEAD --search "<keyword>"
  • Note: Tag retrieval is mainly used to assist lead retrieval/entry, and is not currently used for customer or opportunity field filtering

10) Retrieve Notifications

  • Query active notifications (ACTIVE/OVERDUE):
    • node scripts/search.mjs notifications --status active
  • Query historical notifications (DONE/OVERDUE):
    • node scripts/search.mjs notifications --status history
  • Filter by category:
    • node scripts/search.mjs notifications --category LEAD_TIMEOUT --status active
  • Pagination query:
    • node scripts/search.mjs notifications --page 2 --limit 20

11) Retrieve Presales Itineraries

  • Query itineraries for a specified time period:
    • node scripts/search.mjs presales-itineraries --start-date 2026-02-10 --end-date 2026-02-16
  • Query itineraries for a specific presales person:
    • node scripts/search.mjs presales-itineraries --user-id <userId> --start-date 2026-02-10 --end-date 2026-02-16
  • Query itineraries for a specific opportunity:
    • node scripts/search.mjs presales-itineraries --opportunity-id <opportunityId>

Public Pool Concept Explanation

Public Pool refers to the pool of leads and customers not assigned to specific salespeople, held by a special "public pool user" in the system.

Public Pool Leads

  • When a lead's
    ownerId
    equals the public pool user ID, the lead belongs to the public pool
  • Query public pool leads:
    node scripts/search.mjs leads --query publicOnly=true
  • Query my leads:
    node scripts/search.mjs leads --query mine=true
  • Public pool user configuration: Environment variable
    PUBLIC_POOL_USER_EMAIL

Public Pool Customers

  • When a customer's
    followUpSalesId
    equals the public pool user ID, the customer belongs to the public pool
  • Query public pool customers:
    node scripts/search.mjs customers --query 'followUpSalesId[]=<public pool user ID>'
  • Query my customers:
    node scripts/search.mjs customers --query 'followUpSalesId[]=<my user ID>'

Get Public Pool User ID

First query current user information to get the public pool user email, then query the user list to get the public pool user ID:
bash
# 1. Query yourself to get system configuration
node scripts/search.mjs me

# 2. Use the public pool user email to query the user ID
node scripts/search.mjs users --search "<public pool user email>"

Output Suggestions

  • Yourself:
    id/name/email/roles
  • Customers:
    id/companyName/customerStatus/followUpSales/_count
  • Business records:
    recordTime/followUpType/contactedPerson/description
  • Opportunities:
    id/name/status/amount/estimatedCloseDate/customer
  • Contacts:
    name/phone/position/roles
  • Leads:
    id/companyName/status/classification/owner/importedAt
  • Tags:
    id/name/category/description/sortOrder/isActive
  • Users:
    id/name/email/roles/createdAt
  • Notifications:
    id/category/title/message/status/isRead/createdAt
  • Presales itineraries:
    id/title/startTime/endTime/tripType/deliveryMode/status/opportunity/customer