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

Function postToGroupChannel

server/src/notifications/wg-slack.ts:38–64  ·  view source on GitHub ↗
(
  groupId: string,
  options: SlackBlockMessage,
)

Source from the content-addressed store, hash-verified

36 * Returns `{ ok: false, error: 'no-channel' }` if no channel exists in the chain.
37 */
38export async function postToGroupChannel(
39 groupId: string,
40 options: SlackBlockMessage,
41): Promise<PostToGroupChannelResult> {
42 const { channelId, viaParent, group } = await workingGroupDb.resolveNotificationChannel(groupId);
43
44 if (!channelId || !group) {
45 logger.warn({ groupId }, 'No Slack channel resolvable for working group');
46 return { ok: false, error: 'no-channel' };
47 }
48
49 // If a private subgroup is falling back to a public parent's channel, flag it —
50 // posting private content to a public channel is almost certainly a leak.
51 if (viaParent && group.is_private) {
52 logger.warn(
53 { groupId, groupSlug: group.slug, parentChannelId: channelId },
54 'Private subgroup posting via parent channel — configure its own channel to keep content private',
55 );
56 }
57
58 const text = viaParent && options.text
59 ? `[${group.name}] ${options.text}`
60 : options.text;
61
62 const result = await sendChannelMessage(channelId, { ...options, text });
63 return { ...result, via_parent: viaParent, resolved_channel_id: channelId };
64}

Callers

nothing calls this directly

Calls 3

sendChannelMessageFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected