AI Capabilities
Detailed documentation of AI features in HotCRM
AI Capabilities
This guide provides detailed documentation for each AI capability in HotCRM, including use cases, configuration, and code examples.
Lead Scoring & Enrichment
Overview
Automatically calculate lead quality scores (0-100) based on profile completeness, company data, and engagement patterns.
How It Works
The lead scoring model evaluates multiple factors:
- Profile Completeness (30%): Email, phone, title, company filled
- Company Quality (40%): Industry, revenue, employee count
- Engagement (30%): Activity count, last activity date
Configuration
// Lead object field definition
{
name: 'LeadScore',
type: 'number',
label: 'Lead Score',
precision: 0,
min: 0,
max: 100,
readonly: true,
description: 'AI-calculated lead quality score (0-100)'
}Usage Example
import { db } from '@hotcrm/core';
// Create a lead - score is auto-calculated
const lead = await db.doc.create('Lead', {
FirstName: 'John',
LastName: 'Doe',
Email: 'john.doe@acme.com',
Company: 'Acme Corporation',
Title: 'VP of Sales',
Industry: 'Technology',
Phone: '+1-555-0123',
AnnualRevenue: 5000000
});
console.log('Lead Score:', lead.LeadScore); // e.g., 85
// Find high-score leads
const hotLeads = await db.find('Lead', {
filters: [
['LeadScore', '>', 70],
['Status', '!=', 'Converted']
],
sort: [['LeadScore', 'desc']],
limit: 20
});Email Signature Enrichment
Extract contact information from email signatures automatically:
// Lead hook example
const enrichFromSignature = async (emailBody: string) => {
const signature = extractSignature(emailBody);
// AI parses signature
const extracted = await aiService.parseSignature(signature);
return {
Phone: extracted.phone,
MobilePhone: extracted.mobile,
Title: extracted.title,
Company: extracted.company,
Website: extracted.website,
EmailSignatureData: JSON.stringify(extracted)
};
};Opportunity Win Prediction
Overview
Predict the probability of winning a deal based on historical data and current opportunity characteristics.
Features
- Win Probability (0-100%): Data-driven success prediction
- Risk Factors: Identify potential deal blockers
- Next Best Action: Suggest optimal follow-up tactics
- Competitive Intelligence: Analyze competitor presence
Fields
// Opportunity AI fields
{
name: 'AIWinProbability',
type: 'percent',
label: 'AI Win Probability',
readonly: true,
description: 'AI-predicted win probability'
},
{
name: 'AIRiskFactors',
type: 'textarea',
label: 'AI Risk Factors',
readonly: true,
description: 'AI-identified potential risks'
},
{
name: 'AINextStepSuggestion',
type: 'text',
label: 'AI Next Step Suggestion',
readonly: true
},
{
name: 'AICompetitiveIntel',
type: 'textarea',
label: 'AI Competitive Intelligence',
readonly: true
}Usage Example
// Get opportunity with AI predictions
const opp = await db.doc.get('Opportunity', oppId, {
fields: [
'Name', 'Amount', 'Stage',
'AIWinProbability',
'AIRiskFactors',
'AINextStepSuggestion',
'AICompetitiveIntel'
]
});
console.log(`Win Probability: ${opp.AIWinProbability}%`);
console.log(`Risk Factors: ${opp.AIRiskFactors}`);
console.log(`Suggested Action: ${opp.AINextStepSuggestion}`);
// Find high-probability deals
const likelyWins = await db.find('Opportunity', {
filters: [
['AIWinProbability', '>', 70],
['Stage', 'not in', ['Closed Won', 'Closed Lost']]
]
});Prediction Model
The AI model considers:
- Deal characteristics (amount, stage, days open)
- Historical win rates by industry/size
- Activity frequency and recency
- Stakeholder engagement
- Competitor presence
- Sales cycle length vs. average
Smart Briefing
Overview
AI-generated summaries of customer interactions, opportunities, and account status.
Features
- Account Summary: 360-degree customer view
- Opportunity Analysis: Deal health and recommendations
- Meeting Briefing: Pre-meeting context and talking points
- Daily Digest: Important updates and actions
Usage Example
// Generate smart briefing for account
const briefing = await aiService.generateBriefing({
accountId: 'acc_123',
includeOpportunities: true,
includeCases: true,
includeActivities: true,
timeRange: 'last_30_days'
});
console.log(briefing.summary);
console.log(briefing.keyInsights);
console.log(briefing.recommendedActions);Example Output
{
"summary": "Acme Corporation (Technology, $5M revenue) has been a customer for 2 years with 3 active opportunities totaling $450K. Recent engagement is high with 12 activities in the last 30 days.",
"keyInsights": [
"Opportunity 'Enterprise Upgrade' ($200K) is in Negotiation stage with 85% win probability",
"2 open support cases, both medium priority, on track for SLA",
"Last meeting was 3 days ago with positive sentiment"
],
"recommendedActions": [
"Schedule follow-up on Enterprise Upgrade pricing",
"Send proposal for Professional Services engagement",
"Check in on Case #1234 resolution"
],
"riskFactors": [
"Competitor 'Salesforce' mentioned in last meeting",
"Contract renewal in 60 days"
]
}Voice-to-Text Transcription
Overview
Automatically transcribe meeting recordings and phone calls to text with action item extraction.
Features
- Multi-language support (English, Chinese)
- Speaker identification
- Action item extraction
- Sentiment analysis
- Key point summarization
Fields
// Activity AI fields
{
name: 'Transcription',
type: 'textarea',
label: 'Meeting Transcription',
readonly: true,
length: 32000
},
{
name: 'TranscriptionSummary',
type: 'textarea',
label: 'AI Meeting Summary',
readonly: true
},
{
name: 'AIActionItems',
type: 'textarea',
label: 'AI Extracted Action Items',
readonly: true
},
{
name: 'AISentiment',
type: 'select',
label: 'AI Sentiment Analysis',
readonly: true,
options: [
{ label: '😊 Positive', value: 'Positive' },
{ label: '😐 Neutral', value: 'Neutral' },
{ label: '😟 Negative', value: 'Negative' }
]
}Usage Example
// Upload recording for transcription
const activity = await db.doc.create('Activity', {
Type: 'Meeting',
Subject: 'Q1 Business Review',
AccountId: 'acc_123',
RecordingUrl: 'https://storage.example.com/recording.mp3'
});
// Transcription happens asynchronously
// Poll or use webhook for completion
const result = await aiService.transcribe({
audioUrl: activity.RecordingUrl,
language: 'en',
speakers: 2
});
// Update activity with results
await db.doc.update('Activity', activity.Id, {
Transcription: result.fullText,
TranscriptionSummary: result.summary,
AIActionItems: result.actionItems.join('\n'),
AISentiment: result.sentiment
});Example Transcription
[00:00] John (Sales): Thanks for joining today. Let's review the proposal.
[00:15] Sarah (Customer): We're interested but have concerns about pricing.
[00:30] John: I understand. Let me walk through the ROI analysis...
[05:45] Sarah: This looks good. Can we get a 10% discount for annual payment?
[06:00] John: Let me check with my manager and get back to you tomorrow.
---
AI Summary:
Customer expressed interest in proposal but requested 10% discount for annual payment. Sales rep committed to follow up tomorrow with manager approval.
Action Items:
- [ ] John: Check with manager on 10% discount approval
- [ ] John: Follow up with Sarah tomorrow
- [ ] Sarah: Review ROI analysis shared during call
Sentiment: PositiveAuto-Categorization
Overview
Automatically categorize cases, leads, and other records based on content analysis.
Case Auto-Categorization
// Case AI fields
{
name: 'AISuggestedType',
type: 'select',
label: 'AI Suggested Type',
readonly: true,
options: [
{ label: '🐛 Problem', value: 'Problem' },
{ label: '❓ Question', value: 'Question' },
{ label: '🆘 Incident', value: 'Incident' },
{ label: '💡 Feature Request', value: 'Feature Request' }
]
},
{
name: 'AISuggestedPriority',
type: 'select',
label: 'AI Suggested Priority',
readonly: true,
options: [
{ label: 'Critical', value: 'Critical' },
{ label: 'High', value: 'High' },
{ label: 'Medium', value: 'Medium' },
{ label: 'Low', value: 'Low' }
]
}Usage Example
// Create case - AI suggests type and priority
const case = await db.doc.create('Case', {
Subject: 'System not responding after update',
Description: 'Critical issue: Our production system crashed after the latest update. All users are affected.',
Origin: 'Email'
});
console.log('AI Suggested Type:', case.AISuggestedType); // "Incident"
console.log('AI Suggested Priority:', case.AISuggestedPriority); // "Critical"
// Auto-accept AI suggestion
await db.doc.update('Case', case.Id, {
Type: case.AISuggestedType,
Priority: case.AISuggestedPriority
});RAG-Based Knowledge Q&A
Overview
Use Retrieval-Augmented Generation (RAG) to answer questions based on your knowledge base with citations.
Architecture
User Question
↓
Vector Embedding
↓
Semantic Search (Top 5 articles)
↓
LLM Context Window
↓
Generated Answer + CitationsKnowledge Article Fields
{
name: 'VectorEmbedding',
type: 'json',
label: 'Vector Embedding',
readonly: true,
description: 'AI-generated semantic vector for similarity search'
},
{
name: 'AISummary',
type: 'textarea',
label: 'AI Summary',
readonly: true
}Usage Example
// Ask a question
const answer = await aiService.askKnowledge({
question: 'How do I reset my password?',
category: 'FAQ', // Optional filter
maxResults: 5
});
console.log('Answer:', answer.text);
console.log('Sources:', answer.sources); // Knowledge article IDs
console.log('Confidence:', answer.confidence); // 0-100
// Example response
{
text: "To reset your password:\n1. Go to the login page\n2. Click 'Forgot Password'\n3. Enter your email\n4. Check your inbox for reset link\n5. Follow the link and create a new password",
sources: [
{ id: 'kb_001', title: 'Password Reset Guide', relevance: 0.95 },
{ id: 'kb_023', title: 'Account Security FAQ', relevance: 0.78 }
],
confidence: 92
}Semantic Search
// Find similar knowledge articles
const similar = await aiService.findSimilarArticles({
articleId: 'kb_123',
limit: 5
});
// Or search by text
const results = await aiService.semanticSearch({
query: 'configure email notifications',
category: 'Product Guide',
limit: 10
});AI Agent Smart Routing
Overview
Intelligently route cases to the best available agent based on skills, workload, and historical performance.
Routing Algorithm
The AI considers:
- Agent skill tags matching case type
- Current workload (active cases)
- Average resolution time by case type
- Customer satisfaction scores
- Agent availability status
- Language requirements
Fields
// Case routing fields
{
name: 'AISuggestedAgent',
type: 'lookup',
label: 'AI Suggested Agent',
referenceTo: 'User',
readonly: true
},
{
name: 'AIRoutingReason',
type: 'text',
label: 'AI Routing Reason',
readonly: true
}Usage Example
// Create case - AI suggests best agent
const supportCase = await db.doc.create('Case', {
Subject: 'API Integration Question',
Type: 'Question',
Priority: 'Medium',
CustomerLanguage: 'English'
});
console.log('Suggested Agent:', supportCase.AISuggestedAgent);
console.log('Routing Reason:', supportCase.AIRoutingReason);
// "Agent has API expertise, lowest workload (3 cases), 95% CSAT"
// Auto-assign or show as suggestion
await db.doc.update('Case', supportCase.Id, {
OwnerId: supportCase.AISuggestedAgent
});Campaign Content Generation
Overview
Generate marketing content including emails, landing pages, and social media posts.
Features
- Email subject lines and body copy
- Landing page outlines
- Social media posts
- A/B test variations
- Audience targeting suggestions
Usage Example
// Generate marketing email
const email = await aiService.generateCampaignContent({
type: 'email',
campaignGoal: 'Product launch',
targetAudience: 'Technology executives',
productName: 'HotCRM Enterprise',
keyFeatures: ['AI-powered', 'Lead-to-Cash', 'Salesforce alternative'],
tone: 'professional',
callToAction: 'Schedule a demo'
});
console.log('Subject:', email.subject);
console.log('Body:', email.body);
// Example output
{
subject: "Transform Your Sales with AI-Powered CRM",
body: `Hi {{FirstName}},
Are you tired of complex CRMs that slow down your sales team?
HotCRM Enterprise is the Salesforce alternative built for modern teams. Our AI-powered platform manages your complete Lead-to-Cash process with:
✨ Intelligent lead scoring
🎯 Win probability predictions
🤖 Automated insights
⚡ Lightning-fast performance
Join forward-thinking companies using HotCRM to close deals faster.
[Schedule a Demo]
Best regards,
The HotCRM Team`,
variations: [
{ subject: "AI CRM That Actually Helps You Sell", tone: "casual" },
{ subject: "See Why Teams Choose HotCRM Over Salesforce", tone: "competitive" }
]
}Product Recommendation
Overview
Recommend product bundles and cross-sell opportunities based on customer profile and purchase history.
Usage Example
// Get product recommendations for quote
const recommendations = await aiService.recommendProducts({
accountId: 'acc_123',
budget: 50000,
existingProducts: ['HotCRM Pro'],
industry: 'Technology'
});
console.log('Recommended Bundle:', recommendations.bundle);
console.log('Cross-sell:', recommendations.crossSell);
// Example response
{
bundle: [
{
productId: 'prod_101',
name: 'HotCRM Enterprise',
reason: 'Upgrade from Pro with AI features',
price: 30000
},
{
productId: 'prod_205',
name: 'Professional Services - Implementation',
reason: 'Recommended for Enterprise customers',
price: 15000
},
{
productId: 'prod_310',
name: 'Premium Support',
reason: 'Technology companies prefer premium SLA',
price: 5000
}
],
totalPrice: 50000,
discount: 0,
crossSell: [
{
productId: 'prod_402',
name: 'Training Package',
reason: 'High adoption rate with Enterprise tier',
price: 3000
}
]
}Next Steps
- AI Overview - AI technology stack and architecture
- Business Logic - Integrate AI into hooks
- ObjectQL API - Query AI-enhanced data
Best Practices
1. Always Provide User Control
// ✅ Good - Show AI suggestion, let user decide
{
name: 'AISuggestedPriority',
type: 'select',
label: 'AI Suggested Priority',
readonly: true
},
{
name: 'Priority',
type: 'select',
label: 'Priority',
defaultValue: '$AISuggestedPriority' // Pre-fill but editable
}2. Explain AI Decisions
// ✅ Good - Include reasoning
{
AIRoutingReason: 'Agent has API expertise, 3 active cases, 95% CSAT'
}
// ❌ Bad - No explanation
{
AISuggestedAgent: 'user_123'
}3. Handle AI Failures Gracefully
try {
const score = await aiService.calculateLeadScore(lead);
return score;
} catch (error) {
console.warn('AI scoring failed, using fallback:', error);
return calculateBasicScore(lead); // Fallback logic
}4. Monitor AI Quality
// Track AI prediction accuracy
await db.doc.create('AIMetric', {
model: 'lead-score-v2',
prediction: score,
actual: converted ? 100 : 0,
error: Math.abs(score - (converted ? 100 : 0))
});