| 1 | import { search_humans, search_interests } from '@humanconnection/toolkit'; |
| 2 | |
| 3 | interface EventTarget { |
| 4 | name: string; |
| 5 | company_name: string; |
| 6 | priority: 'high' | 'medium' | 'low'; |
| 7 | } |
| 8 | |
| 9 | interface ResearchResult { |
| 10 | target: EventTarget; |
| 11 | found: boolean; |
| 12 | confidence: number; |
| 13 | bio?: string; |
| 14 | location?: string; |
| 15 | linkedin?: string; |
| 16 | twitter?: string; |
| 17 | instagram?: string; |
| 18 | interests?: string[]; |
| 19 | } |
| 20 | |
| 21 | async function researchEventTargets( |
| 22 | eventName: string, |
| 23 | targets: EventTarget[] |
| 24 | ): Promise<ResearchResult[]> { |
| 25 | console.log(`\n=== Researching targets for ${eventName} ===\n`); |
| 26 | |
| 27 | const results: ResearchResult[] = []; |
| 28 | |
| 29 | for (const target of targets) { |
| 30 | const humans = await search_humans({ |
| 31 | name: target.name, |
| 32 | company_name: target.company_name, |
| 33 | }); |
| 34 | |
| 35 | if (humans.length > 0 && humans[0].confidence > 0.3) { |
| 36 | const human = humans[0]; |
| 37 | |
| 38 | // Discover interests for event matching |
| 39 | const interests = await search_interests({ |
| 40 | name: target.name, |
| 41 | linkedin_url: human.profiles.linkedin_profile_url, |
| 42 | x_url: human.profiles.x_profile_url, |
| 43 | }); |
| 44 | |
| 45 | const result: ResearchResult = { |
| 46 | target, |
| 47 | found: true, |
| 48 | confidence: human.confidence, |
| 49 | bio: human.bio, |
| 50 | location: human.location, |
| 51 | linkedin: human.profiles.linkedin_profile_url, |
| 52 | twitter: human.profiles.x_profile_url, |
| 53 | instagram: human.profiles.instagram_profile_url, |
| 54 | interests: interests.signals.map(s => s.signal), |
| 55 | }; |
| 56 | results.push(result); |
| 57 | |
| 58 | console.log(`[FOUND] ${target.name} (${target.priority} priority)`); |
| 59 | console.log(` Confidence: ${human.confidence}`); |
| 60 | console.log(` Bio: ${human.bio}`); |
| 61 | if (human.profiles.linkedin_profile_url) { |
| 62 | console.log(` LinkedIn: ${human.profiles.linkedin_profile_url}`); |
| 63 | } |
| 64 | if (human.profiles.x_profile_url) { |
| 65 | console.log(` X: ${human.profiles.x_profile_url}`); |
| 66 | } |
| 67 | if (result.interests?.length) { |
| 68 | console.log(` Interests: ${result.interests.join(', ')}`); |
| 69 | } |
| 70 | } else { |
| 71 | results.push({ target, found: false, confidence: 0 }); |
| 72 | console.log(`[NOT FOUND] ${target.name}`); |
| 73 | } |
| 74 | console.log(); |
| 75 | } |
| 76 | |
| 77 | return results; |
| 78 | } |
| 79 | |
| 80 | // --- Run the research --- |
| 81 | |
| 82 | const saastrTargets: EventTarget[] = [ |
| 83 | { |
| 84 | name: 'Jason Lemkin', |
| 85 | company_name: 'SaaStr', |
| 86 | priority: 'high', |
| 87 | }, |
| 88 | { |
| 89 | name: 'Godard Abel', |
| 90 | company_name: 'G2', |
| 91 | priority: 'high', |
| 92 | }, |
| 93 | { |
| 94 | name: 'Yamini Rangan', |
| 95 | company_name: 'HubSpot', |
| 96 | priority: 'medium', |
| 97 | }, |
| 98 | { |
| 99 | name: 'Henrique Dubugras', |
| 100 | company_name: 'Brex', |
| 101 | priority: 'medium', |
| 102 | }, |
| 103 | { |
| 104 | name: 'Christina Cacioppo', |
| 105 | company_name: 'Vanta', |
| 106 | priority: 'high', |
| 107 | }, |
| 108 | ]; |
| 109 | |
| 110 | async function main() { |
| 111 | const results = await researchEventTargets('SaaStr Annual 2026', saastrTargets); |
| 112 | |
| 113 | // Prioritize: sort by priority then confidence |
| 114 | const priorityOrder = { high: 0, medium: 1, low: 2 }; |
| 115 | const found = results |
| 116 | .filter(r => r.found) |
| 117 | .sort((a, b) => { |
| 118 | const pDiff = priorityOrder[a.target.priority] - priorityOrder[b.target.priority]; |
| 119 | return pDiff !== 0 ? pDiff : b.confidence - a.confidence; |
| 120 | }); |
| 121 | |
| 122 | console.log(`\n=== Prioritized Target List ===\n`); |
| 123 | for (const r of found) { |
| 124 | console.log(`${r.target.priority.toUpperCase()} | ${r.target.name} | confidence: ${r.confidence}`); |
| 125 | if (r.linkedin) console.log(` Pre-event: Connect on LinkedIn - ${r.linkedin}`); |
| 126 | if (r.twitter) console.log(` Pre-event: Engage on X - ${r.twitter}`); |
| 127 | if (r.interests?.length) console.log(` Conversation starters: ${r.interests.join(', ')}`); |
| 128 | } |
| 129 | |
| 130 | console.log(`\n--- Summary ---`); |
| 131 | console.log(`Targets: ${results.length}`); |
| 132 | console.log(`Found: ${found.length}`); |
| 133 | console.log(`High priority found: ${found.filter(r => r.target.priority === 'high').length}`); |
| 134 | } |
| 135 | |
| 136 | main(); |