Scenario
Your lead scoring model assigns hot/warm/cold tiers — but does the scoring actually predict engagement? This job pulls scored leads from each tier, creates a persona per score bucket, then runs a focus group asking “Would you respond to this outreach?” with your real email templates as stimulus. The output validates whether your scoring model aligns with buyer reality.Architecture
Code
import os, requests
SF = os.environ["SALESFORCE_INSTANCE"]
SF_T = os.environ["SALESFORCE_ACCESS_TOKEN"]
MV_K = os.environ["MAVERA_API_KEY"]
SF_H = {"Authorization": f"Bearer {SF_T}"}
MV_H = {"Authorization": f"Bearer {MV_K}", "Content-Type": "application/json"}
TIERS = {"hot": "Rating = 'Hot'", "warm": "Rating = 'Warm'", "cold": "Rating = 'Cold'"}
EMAIL_TEMPLATE = (
"Subject: Quick call this week?\n\n"
"Hi {{Name}}, given your team's growth, I'd love 15 minutes to show "
"how we've helped similar companies cut onboarding time by 40%."
)
persona_ids = []
for tier, where in TIERS.items():
leads = requests.get(
f"https://{SF}/services/data/v66.0/query", headers=SF_H,
params={"q": f"SELECT Name, Title, Company, Industry FROM Lead WHERE {where} LIMIT 20"},
).json()["records"]
titles = [l.get("Title", "Manager") for l in leads]
top = max(set(titles), key=titles.count) if titles else "Manager"
p = requests.post(
"https://app.mavera.io/api/v1/personas", headers=MV_H,
json={
"name": f"{tier.title()} Lead — {top}",
"description": f"'{tier}' scored leads. Typical role: {top}. Based on {len(leads)} leads.",
},
).json()
persona_ids.append(p["id"])
fg = requests.post(
"https://app.mavera.io/api/v1/focus-groups", headers=MV_H,
json={
"persona_ids": persona_ids,
"questions": [
{"type": "nps", "text": "You receive this email. How likely are you to respond (0-10)?"},
{"type": "open_ended", "text": f"Here is the outreach email:\n\n{EMAIL_TEMPLATE}\n\nWould you open, reply, or ignore? Why?"},
{"type": "open_ended", "text": "What would make you more likely to engage with cold outreach?"},
{"type": "open_ended", "text": "Describe the last vendor email you actually replied to. What stood out?"},
],
},
).json()
print(f"Focus Group: {fg['id']}")
for r in fg.get("responses", []):
print(f"\n[{r['persona_name']}] Q: {r['question'][:60]}...")
print(f" A: {r['response']}")
const SF = process.env.SALESFORCE_INSTANCE;
const SF_T = process.env.SALESFORCE_ACCESS_TOKEN;
const MV_K = process.env.MAVERA_API_KEY;
const mvH = { Authorization: `Bearer ${MV_K}`, "Content-Type": "application/json" };
const TIERS = { hot: "Rating = 'Hot'", warm: "Rating = 'Warm'", cold: "Rating = 'Cold'" };
const EMAIL_TEMPLATE =
"Subject: Quick call this week?\n\nHi {{Name}}, given your team's growth, " +
"I'd love 15 minutes to show how we've helped similar companies cut onboarding time by 40%.";
async function sfQuery(soql) {
return (await fetch(
`https://${SF}/services/data/v66.0/query?q=${encodeURIComponent(soql)}`,
{ headers: { Authorization: `Bearer ${SF_T}` } }
).then((r) => r.json())).records;
}
const personaIds = [];
for (const [tier, where] of Object.entries(TIERS)) {
const leads = await sfQuery(`SELECT Name, Title, Company, Industry FROM Lead WHERE ${where} LIMIT 20`);
const titles = leads.map((l) => l.Title || "Manager");
const top = [...new Set(titles)].sort(
(a, b) => titles.filter((t) => t === b).length - titles.filter((t) => t === a).length
)[0];
const p = await fetch("https://app.mavera.io/api/v1/personas", {
method: "POST", headers: mvH,
body: JSON.stringify({
name: `${tier.charAt(0).toUpperCase() + tier.slice(1)} Lead — ${top}`,
description: `'${tier}' scored leads. Typical role: ${top}. Based on ${leads.length} leads.`,
}),
}).then((r) => r.json());
personaIds.push(p.id);
}
const fg = await fetch("https://app.mavera.io/api/v1/focus-groups", {
method: "POST", headers: mvH,
body: JSON.stringify({
persona_ids: personaIds,
questions: [
{ type: "nps", text: "You receive this email. How likely are you to respond (0-10)?" },
{ type: "open_ended", text: `Here is the outreach email:\n\n${EMAIL_TEMPLATE}\n\nWould you open, reply, or ignore? Why?` },
{ type: "open_ended", text: "What would make you more likely to engage with cold outreach?" },
{ type: "open_ended", text: "Describe the last vendor email you actually replied to. What stood out?" },
],
}),
}).then((r) => r.json());
console.log(`Focus Group: ${fg.id}`);
(fg.responses || []).forEach((r) => {
console.log(`\n[${r.persona_name}] Q: ${r.question.slice(0, 60)}...`);
console.log(` A: ${r.response}`);
});
Example Output
{
"id": "fg_9wT2r",
"summary": { "hot_nps_avg": 8.2, "warm_nps_avg": 5.4, "cold_nps_avg": 2.1 },
"responses": [
{
"persona_name": "Hot Lead — VP Engineering",
"question": "Would you open, reply, or ignore? Why?",
"response": "I'd reply. The 40% stat is specific enough to be credible, and the ask is low-commitment."
},
{
"persona_name": "Cold Lead — Manager",
"question": "Would you open, reply, or ignore? Why?",
"response": "Archive. Nothing here tells me you know anything about my company or my problems."
}
]
}
If cold personas give high NPS scores, your model is too conservative — you’re leaving deals on the table. If hot personas score low, your model over-weights firmographic fit without considering timing or intent.
Salesforce Overview
Back to all 8 Salesforce jobs
Pipeline-Aware Content Generation
Next: Generate stage-specific nurture content