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

Function notifyRegistryCreate

server/src/notifications/registry.ts:77–116  ·  view source on GitHub ↗
(record: {
  entity_type: 'brand' | 'property';
  domain: string;
  editor_email?: string;
  editor_name?: string;
})

Source from the content-addressed store, hash-verified

75 * Notify when a new record is created and pending Addie review.
76 */
77export async function notifyRegistryCreate(record: {
78 entity_type: 'brand' | 'property';
79 domain: string;
80 editor_email?: string;
81 editor_name?: string;
82}): Promise<string | null> {
83 const channelId = getChannelId();
84 if (!channelId || !isSlackConfigured()) return null;
85
86 const emoji = record.entity_type === 'brand' ? '🏷️' : '🌐';
87 const typeLabel = record.entity_type === 'brand' ? 'Brand' : 'Property';
88 const editorDisplay = record.editor_name || record.editor_email || 'Unknown';
89
90 const message: SlackBlockMessage = {
91 text: `${emoji} New ${typeLabel.toLowerCase()}: ${record.domain} by ${editorDisplay} - awaiting review`,
92 blocks: [
93 {
94 type: 'section',
95 text: {
96 type: 'mrkdwn',
97 text: `${emoji} *New ${typeLabel.toLowerCase()} record:* \`${record.domain}\`\n_Awaiting Addie review_`,
98 },
99 },
100 {
101 type: 'section',
102 fields: [
103 { type: 'mrkdwn', text: `*Created by:*\n${editorDisplay}` },
104 ],
105 },
106 ],
107 };
108
109 try {
110 const result = await sendChannelMessage(channelId, message);
111 return result.ts || null;
112 } catch (error) {
113 logger.error({ error, domain: record.domain }, 'Failed to send registry create notification');
114 return null;
115 }
116}
117
118/**
119 * Notify when Addie approves a new record.

Callers 2

setupRoutesMethod · 0.85
handleToolCallMethod · 0.85

Calls 3

getChannelIdFunction · 0.85
isSlackConfiguredFunction · 0.85
sendChannelMessageFunction · 0.85

Tested by

no test coverage detected