← Volver a plantillas
CRM
salesGestione contactos, empresas y oportunidades a lo largo de su embudo de ventas.
Colecciones
Contacts
People and their contact information
Campos del esquema
name:stringemail:stringphone:stringcompany:stringtitle:stringsource:stringnotes:string
Companies
Organizations and accounts
Campos del esquema
name:stringdomain:stringindustry:stringsize:stringannual_revenue:number
Deals
Sales opportunities and pipeline
Campos del esquema
title:stringamount:numbercurrency:stringstage:stringclose_date:stringprobability:number
Relaciones
contacts
works_at
companiesContact works at companycontacts
owns_deal
dealsContact owns or is associated with dealConsultas de ejemplo
Consulte los datos de esta plantilla usando el endpoint SQL.
Pipeline by stage
Total deal value and count grouped by pipeline stage.
SELECT
data.stage.:String as stage,
count() as deal_count,
sum(CAST(data.amount, 'Float64')) as total_value
FROM records FINAL
WHERE workspace_id = {workspace_id:String}
AND collection = 'deals'
AND deleted = false
GROUP BY stage
ORDER BY total_value DESCWeighted pipeline
Calculate expected revenue by multiplying deal amounts by their close probability.
SELECT
data.title.:String as deal,
data.stage.:String as stage,
CAST(data.amount, 'Float64') as amount,
CAST(data.probability, 'Float64') as probability,
CAST(data.amount, 'Float64') * CAST(data.probability, 'Float64') / 100 as expected_revenue
FROM records FINAL
WHERE workspace_id = {workspace_id:String}
AND collection = 'deals'
AND deleted = false
AND data.stage.:String NOT IN ('closed_won', 'closed_lost')
ORDER BY expected_revenue DESCContacts by source
Count contacts grouped by acquisition source.
SELECT
data.source.:String as source,
count() as contact_count
FROM records FINAL
WHERE workspace_id = {workspace_id:String}
AND collection = 'contacts'
AND deleted = false
GROUP BY source
ORDER BY contact_count DESCDeals closing this month
Find deals with a close date in the current month.
SELECT
data.title.:String as deal,
data.stage.:String as stage,
CAST(data.amount, 'Float64') as amount,
data.close_date.:String as close_date
FROM records FINAL
WHERE workspace_id = {workspace_id:String}
AND collection = 'deals'
AND deleted = false
AND toYYYYMM(CAST(data.close_date.:String, 'Date')) = toYYYYMM(today())
ORDER BY close_date ASCInicio rápido
Cree las colecciones usando el Rekor CLI:
rekor collections upsert contacts --workspace my-crm --schema @contacts.jsonEsquema completo (JSON)
Copie la definición completa de la plantilla:
{
"collections": [
{
"id": "contacts",
"name": "Contacts",
"description": "People and their contact information",
"icon": "user",
"color": "#3b82f6",
"json_schema": {
"type": "object",
"required": [
"name",
"email"
],
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"phone": {
"type": "string"
},
"company": {
"type": "string"
},
"title": {
"type": "string"
},
"source": {
"type": "string",
"enum": [
"inbound",
"outbound",
"referral",
"organic"
]
},
"notes": {
"type": "string"
}
}
}
},
{
"id": "companies",
"name": "Companies",
"description": "Organizations and accounts",
"icon": "building",
"color": "#8b5cf6",
"json_schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"domain": {
"type": "string"
},
"industry": {
"type": "string"
},
"size": {
"type": "string",
"enum": [
"1-10",
"11-50",
"51-200",
"201-1000",
"1000+"
]
},
"annual_revenue": {
"type": "number"
}
}
}
},
{
"id": "deals",
"name": "Deals",
"description": "Sales opportunities and pipeline",
"icon": "dollar-sign",
"color": "#22c55e",
"json_schema": {
"type": "object",
"required": [
"title",
"amount",
"stage"
],
"properties": {
"title": {
"type": "string"
},
"amount": {
"type": "number",
"minimum": 0
},
"currency": {
"type": "string",
"enum": [
"USD",
"EUR",
"GBP",
"BRL"
],
"default": "USD"
},
"stage": {
"type": "string",
"enum": [
"lead",
"qualified",
"proposal",
"negotiation",
"closed_won",
"closed_lost"
]
},
"close_date": {
"type": "string",
"format": "date"
},
"probability": {
"type": "number",
"minimum": 0,
"maximum": 100
}
}
}
}
],
"relationships": [
{
"type": "works_at",
"source": "contacts",
"target": "companies",
"description": "Contact works at company"
},
{
"type": "owns_deal",
"source": "contacts",
"target": "deals",
"description": "Contact owns or is associated with deal"
}
]
}