fix(slack): add reactionNotifications config check to reactions handler

The Slack reactions handler was processing all reactions unconditionally,
ignoring the reactionNotifications config setting.

This adds the same filtering logic that exists in Telegram/Discord/Signal:
- Check reactionMode config (off/own/all/allowlist)
- Skip bot's own reactions
- For 'own' mode, only process reactions on messages sent by the bot
- For 'allowlist' mode, only process reactions from allowlisted users

Fixes reactions not being routed to agent sessions when configured.
This commit is contained in:
Jonathan Tsai 2026-01-26 23:37:46 -08:00
parent 54d6cd70b8
commit 4363e435eb
No known key found for this signature in database

View File

@ -12,6 +12,26 @@ export function registerSlackReactionEvents(params: { ctx: SlackMonitorContext }
const handleReactionEvent = async (event: SlackReactionEvent, action: string) => { const handleReactionEvent = async (event: SlackReactionEvent, action: string) => {
try { try {
// Check reactionNotifications config (consistent with Telegram/Discord/Signal)
const reactionMode = ctx.reactionMode ?? "own";
if (reactionMode === "off") return;
// Skip bot reactions (consistent with other providers)
if (event.user === ctx.botUserId) return;
// For "own" mode, only process reactions on messages sent by this bot
if (reactionMode === "own" && event.item_user !== ctx.botUserId) return;
// For "allowlist" mode, only process reactions from allowlisted users
if (reactionMode === "allowlist") {
const allowlist = ctx.reactionAllowlist ?? [];
if (allowlist.length === 0) return;
const userAllowed = allowlist.some(
(entry) => String(entry).toLowerCase() === String(event.user).toLowerCase(),
);
if (!userAllowed) return;
}
const item = event.item; const item = event.item;
if (!item || item.type !== "message") return; if (!item || item.type !== "message") return;