-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateOutreach.js
More file actions
57 lines (42 loc) · 2.23 KB
/
generateOutreach.js
File metadata and controls
57 lines (42 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function pick(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
function formatIssues(issues) {
if (issues.length === 1) return issues[0];
if (issues.length === 2) return `${issues[0]} and ${issues[1]}`;
return issues.slice(0, 2).join(" and ");
}
function generateOutreach(business) {
const name = business?.name || "your business";
const missing = business?.llm?.missing_features || [];
// ✅ ALWAYS pain-based if issues exist
if (missing.length > 0) {
const issues = missing.slice(0, 2);
const issueText = formatIssues(issues);
const openings = [
`Hey ${name} team,`,
`Hi ${name},`,
`Hey, I came across ${name} and noticed something quick —`,
];
const bodies = [
`I noticed your website is missing ${issueText}, which could be costing you potential customers who prefer quick online interactions.`,
`It looks like your site doesn’t currently have ${issueText}, which might be causing you to lose leads that don’t want to call directly.`,
`One thing that stood out is the absence of ${issueText} — that usually impacts how many visitors actually convert into customers.`,
];
const closings = [
`We help service businesses add simple automation like chat and booking systems that capture leads 24/7. Would you be open to a quick 5-minute demo?`,
`We’ve helped similar businesses capture more leads by adding lightweight automation. Happy to show you what that could look like if you're open.`,
`We specialize in fixing exactly this with simple automation tools. Let me know if you'd be open to a quick walkthrough.`,
];
return {
outreach: `${pick(openings)} ${pick(bodies)} ${pick(closings)}`,
};
}
// ✅ ONLY if no issues → soft pitch
const variants = [
`Hey ${name} team, I came across your website and it looks solid. If you're ever looking to increase conversions or automate customer interactions, we help businesses like yours grow efficiently.`,
`Hi ${name}, your site is already well set up. We work with businesses to further improve lead capture and streamline customer communication if that's something you're exploring.`,
];
return { outreach: pick(variants) };
}
module.exports = { generateOutreach };