Objective
After the sales input is provided in natural language, automatically organize it and create a business record. If information is missing, remind the user to supplement it first. Before submission, the user must confirm.
Note: The business record query function has been moved to the lcrm-search skill. This skill is only responsible for creating business records.
Script Entry
- Main script:
node scripts/business-record.mjs <action> [options] - Environment variables:
- Required:
LCRM_API_KEY - Optional:
LCRM_BASE_URL(defaulthttps://crm.langcore.net)
- Required:
Target API
POST /api/business-records
Key fields of the request body:
- Required:
customerIdorleadId(choose one; for sales scenarios, prefercustomerId)followUpType(enum)contactedPersondescription(at least 10 characters after removing HTML)
- Optional:
opportunityIdopportunityStatusestimatedCloseDateactualCloseDateattachments
followUpType enum:
微信电话线上会议邮件现场拜访商务活动其他
Mandatory Process
- Parse the user input and extract:
- Customer name
- Contact name
- Follow-up type (if it cannot be determined, leave it empty first)
- Record content
- Convert customer name to ID:
- Script:
node scripts/business-record.mjs find-customer --company-name "<客户名>" --limit 5 - No result: inform the user that the customer does not exist and ask the user to supplement the exact name.
- Multiple results: list the candidates and ask the user to confirm the unique customer.
- Script:
- Contact validation (recommended):
- Script:
node scripts/business-record.mjs customer-detail --customer-id "<customerId>", check whether the contact exists. - If not matched, do not block, but prompt "The contact was not matched in the system, and will be written into contactedPerson as text."
- Script:
- Assemble the payload and perform local validation:
descriptionlength >= 10followUpTypemust be in the enum
- Confirm before submission (mandatory):
- Output a confirmation card, including at least:
customerId+ customer namecontactedPersonfollowUpTypedescriptionsummary
- Only execute POST when the user explicitly replies "confirm/submit/yes".
- Output a confirmation card, including at least:
- Submit and return the result:
- Script:
node scripts/business-record.mjs create --payload '<JSON>'or--payload-file <file> - Success: return
idand key fields. - Failure: expose the backend error and provide suggestions for the next step.
- Script:
Command Examples
node scripts/business-record.mjs create \
--customer-id "<customerId>" \
--follow-up-type "电话" \
--contacted-person "张三" \
--description "已与客户确认POC范围和预算,预计下周提交技术方案。"
Missing Information Prompt Templates
When the following fields are missing, directly ask the user:
- Missing customer name:
请补充客户名称。 - Missing contact:
请补充本次对接人姓名。 - Missing follow-up type:
请补充跟进类型(微信/电话/线上会议/邮件/现场拜访/商务活动/其他)。 - Missing record content or fewer than 10 characters:
请补充更完整的跟进记录(至少 10 个字)。 - Request returned an error:
请先完善联系人信息(姓名、电话、角色)后再新增商务记录(At this point, the user needs to go to the LCRM system web end to complete the contact information).