needs-reply: filter by franz.hubert@docfast.dev assignee
This commit is contained in:
parent
5dc184a33b
commit
edc030e932
1 changed files with 6 additions and 1 deletions
|
|
@ -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 || [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue