MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / notifyNewProspect

Function notifyNewProspect

server/src/notifications/prospect.ts:119–229  ·  view source on GitHub ↗
(data: {
  orgName: string;
  domain: string;
  owner: 'addie' | 'human';
  priority?: 'high' | 'standard';
  verdict: string;
  companyType?: string;
  source: string;
  orgId?: string;
  contactName?: string;
  contactEmail?: string;
})

Source from the content-addressed store, hash-verified

117}
118
119export async function notifyNewProspect(data: {
120 orgName: string;
121 domain: string;
122 owner: 'addie' | 'human';
123 priority?: 'high' | 'standard';
124 verdict: string;
125 companyType?: string;
126 source: string;
127 orgId?: string;
128 contactName?: string;
129 contactEmail?: string;
130}): Promise<boolean> {
131 if (!isSlackConfigured()) {
132 logger.debug('Slack not configured, skipping prospect notification');
133 return false;
134 }
135
136 const channel = await getProspectChannel();
137 if (!channel.channel_id) {
138 logger.debug('Prospect channel not configured, skipping notification');
139 return false;
140 }
141
142 const typeLabel = data.companyType ? getCompanyTypeLabel(data.companyType) : 'Unknown';
143 const sourceLabel = data.source === 'slack' ? 'Slack join' : data.source === 'inbound' ? 'Website signup' : data.source;
144 const priorityLabel = data.priority === 'high' ? 'High priority' : 'Standard';
145
146 const isHumanNeeded = data.owner === 'human';
147 const hasOrg = !!data.orgId;
148 const headerText = isHumanNeeded
149 ? 'Enterprise prospect needs an owner'
150 : 'New prospect auto-triaged';
151 const ownerLabel = isHumanNeeded
152 ? 'Needs a human owner'
153 : hasOrg
154 ? `Addie (auto-claimed${data.priority === 'high' ? ', high priority' : ''})`
155 : `Addie (recommended${data.priority === 'high' ? ', high priority' : ''})`;
156
157 const text = isHumanNeeded
158 ? `Enterprise prospect needs an owner: ${data.orgName} (${data.domain})`
159 : `New prospect: ${data.orgName} (${data.domain})`;
160
161 const blocks: SlackBlock[] = [
162 {
163 type: 'header',
164 text: { type: 'plain_text', text: headerText, emoji: true } as SlackTextObject,
165 },
166 {
167 type: 'section',
168 fields: [
169 { type: 'mrkdwn', text: `*Company:*\n${data.orgName}` },
170 { type: 'mrkdwn', text: `*Domain:*\n${data.domain}` },
171 { type: 'mrkdwn', text: `*Type:*\n${typeLabel}` },
172 { type: 'mrkdwn', text: `*Source:*\n${sourceLabel}` },
173 ],
174 },
175 ];
176

Callers 2

triageAndNotifyFunction · 0.85
triageAndCreateProspectFunction · 0.85

Calls 6

isSlackConfiguredFunction · 0.85
getProspectChannelFunction · 0.85
getCompanyTypeLabelFunction · 0.85
signedUpByBlockFunction · 0.85
sendChannelMessageFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected