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

Function notifyAliasMatch

server/src/notifications/prospect.ts:33–117  ·  view source on GitHub ↗
(data: {
  signupDomain: string;
  matchedDomain: string;
  method: string;
  orgId: string;
  orgName: string;
  companyType?: string;
  source: string;
  contactName?: string;
  contactEmail?: string;
})

Source from the content-addressed store, hash-verified

31}
32
33export async function notifyAliasMatch(data: {
34 signupDomain: string;
35 matchedDomain: string;
36 method: string;
37 orgId: string;
38 orgName: string;
39 companyType?: string;
40 source: string;
41 contactName?: string;
42 contactEmail?: string;
43}): Promise<boolean> {
44 if (!isSlackConfigured()) {
45 logger.debug('Slack not configured, skipping alias match notification');
46 return false;
47 }
48
49 const channel = await getProspectChannel();
50 if (!channel.channel_id) {
51 logger.debug('Prospect channel not configured, skipping alias match notification');
52 return false;
53 }
54
55 const sourceLabel = data.source === 'slack' ? 'Slack join' : data.source === 'inbound' ? 'Website signup' : data.source;
56 const methodLabel = MATCH_METHOD_LABELS[data.method] ?? data.method;
57 const text = `Signup matched to existing org: ${data.orgName} (${data.signupDomain} → ${data.matchedDomain})`;
58
59 const fields: SlackTextObject[] = [
60 { type: 'mrkdwn', text: `*Company:*\n${data.orgName}` },
61 { type: 'mrkdwn', text: `*Signup domain:*\n${data.signupDomain}` },
62 { type: 'mrkdwn', text: `*Matched domain:*\n${data.matchedDomain}` },
63 { type: 'mrkdwn', text: `*Match method:*\n${methodLabel}` },
64 { type: 'mrkdwn', text: `*Source:*\n${sourceLabel}` },
65 ];
66
67 if (data.companyType) {
68 fields.push({ type: 'mrkdwn', text: `*Type:*\n${getCompanyTypeLabel(data.companyType)}` });
69 }
70
71 const blocks: SlackBlock[] = [
72 {
73 type: 'header',
74 text: { type: 'plain_text', text: 'Signup matched to existing org', emoji: true } as SlackTextObject,
75 },
76 {
77 type: 'section',
78 fields,
79 },
80 ];
81
82 const aliasContactBlock = signedUpByBlock(data.contactName, data.contactEmail);
83 if (aliasContactBlock) blocks.push(aliasContactBlock);
84
85 blocks.push({
86 type: 'actions',
87 elements: [
88 {
89 type: 'button',
90 text: { type: 'plain_text', text: 'Add domain to org', emoji: true },

Callers 1

handleSkipSideEffectsFunction · 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