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

Function notifyRegistryEdit

server/src/notifications/registry.ts:27–72  ·  view source on GitHub ↗
(edit: {
  entity_type: 'brand' | 'property';
  domain: string;
  editor_email?: string;
  editor_name?: string;
  edit_summary: string;
  revision_number: number;
})

Source from the content-addressed store, hash-verified

25 * Returns the Slack message timestamp for threading.
26 */
27export async function notifyRegistryEdit(edit: {
28 entity_type: 'brand' | 'property';
29 domain: string;
30 editor_email?: string;
31 editor_name?: string;
32 edit_summary: string;
33 revision_number: number;
34}): Promise<string | null> {
35 const channelId = getChannelId();
36 if (!channelId || !isSlackConfigured()) return null;
37
38 const emoji = edit.entity_type === 'brand' ? '🏷️' : '🌐';
39 const typeLabel = edit.entity_type === 'brand' ? 'Brand' : 'Property';
40 const editorDisplay = edit.editor_name || edit.editor_email || 'Unknown';
41 const viewUrl = edit.entity_type === 'brand'
42 ? `${APP_URL}/brand/view/${edit.domain}`
43 : `${APP_URL}/property/view/${edit.domain}`;
44
45 const message: SlackBlockMessage = {
46 text: `${emoji} ${typeLabel} edited: ${edit.domain} by ${editorDisplay}`,
47 blocks: [
48 {
49 type: 'section',
50 text: {
51 type: 'mrkdwn',
52 text: `${emoji} *${typeLabel} edited:* <${viewUrl}|${edit.domain}> (rev ${edit.revision_number})`,
53 },
54 },
55 {
56 type: 'section',
57 fields: [
58 { type: 'mrkdwn', text: `*Editor:*\n${editorDisplay}` },
59 { type: 'mrkdwn', text: `*Summary:*\n${edit.edit_summary}` },
60 ],
61 },
62 ],
63 };
64
65 try {
66 const result = await sendChannelMessage(channelId, message);
67 return result.ts || null;
68 } catch (error) {
69 logger.error({ error, domain: edit.domain }, 'Failed to send registry edit notification');
70 return null;
71 }
72}
73
74/**
75 * Notify when a new record is created and pending Addie review.

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