diff --git a/bin/docfast-support b/bin/docfast-support index 1b99363..d10ec08 100755 --- a/bin/docfast-support +++ b/bin/docfast-support @@ -147,7 +147,8 @@ async function cmdReply(args) { } async function cmdNeedsReply(args) { - // Show only tickets where the last non-note thread is from a customer (needs agent reply) + // Show only tickets assigned to the AI agent (franz.hubert@docfast.dev) where the last non-note thread is from a customer + const AI_AGENT_EMAIL = 'franz.hubert@docfast.dev'; const page = getFlag(args, '--page') || '1'; let endpoint = `/conversations?page=${page}&status=active`; if (MAILBOX_ID) endpoint += `&mailboxId=${MAILBOX_ID}`; @@ -160,6 +161,10 @@ async function cmdNeedsReply(args) { const needsReply = []; for (const c of conversations) { + // Only tickets assigned to the AI agent + const assignee = c.assignee?.email || c.user?.email || ''; + if (assignee.toLowerCase() !== AI_AGENT_EMAIL.toLowerCase()) continue; + const tRes = await apiRequest('GET', `/conversations/${c.id}/threads`); if (tRes.status !== 200) continue; const threads = (tRes.data._embedded?.threads || [])