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

Function handleReactionAdded

server/src/slack/events.ts:597–626  ·  view source on GitHub ↗
(event: SlackReactionAddedEvent)

Source from the content-addressed store, hash-verified

595 * Records reaction activity for engagement tracking
596 */
597export async function handleReactionAdded(event: SlackReactionAddedEvent): Promise<void> {
598 logger.debug(
599 { userId: event.user, reaction: event.reaction, channel: event.item.channel },
600 'User added reaction'
601 );
602
603 try {
604 // Get user's org mapping if they're linked
605 const mapping = await slackDb.getBySlackUserId(event.user);
606 let organizationId: string | undefined;
607
608 if (mapping?.workos_user_id) {
609 // Note: Would need to lookup org from WorkOS - for now just record without org
610 }
611
612 await slackDb.recordActivity({
613 slack_user_id: event.user,
614 activity_type: 'reaction',
615 channel_id: event.item.channel,
616 activity_timestamp: new Date(parseFloat(event.event_ts) * 1000),
617 organization_id: organizationId,
618 metadata: {
619 reaction: event.reaction,
620 item_type: event.item.type,
621 },
622 });
623 } catch (error) {
624 logger.error({ error, userId: event.user }, 'Failed to record reaction activity');
625 }
626}
627
628/**
629 * Main event dispatcher

Callers 1

handleSlackEventFunction · 0.70

Calls 2

getBySlackUserIdMethod · 0.80
recordActivityMethod · 0.80

Tested by

no test coverage detected