function getTitle(item) { if (item.json.Name && item.json.Name.title && Array.isArray(item.json.Name.title) && item.json.Name.title.length > 0) { return item.json.Name.title[0].plain_text; } if (item.json.title && Array.isArray(item.json.title) && item.json.title.length > 0) { return item.json.title[0].plain_text; } return "Untitled"; } const items = $input.all(); const taskBlocks = []; if (items.length === 0) { taskBlocks.push({ type: "TextBlock", text: "No new tasks were completed today.", color: "warning", weight: "Bolder" }); } else { items.forEach(item => { const projectType = item.json.ProjectType || ""; const priority = item.json.Priority || ""; const taskName = getTitle(item); const description = item.json.Description || "No description provided."; const status = item.json.Status || ""; let statusBadge = "PENDING"; let badgeColor = "Default"; if (status === "In Progress") { statusBadge = "IN PROGRESS"; badgeColor = "Accent"; } else if (status === "Done") { statusBadge = "DONE"; badgeColor = "Good"; } const prefix = [projectType, priority].filter(Boolean).join("-"); const title = prefix ? `[${prefix}]: ${taskName}` : taskName; taskBlocks.push({ type: "ColumnSet", spacing: "Medium", separator: true, columns: [ { type: "Column", width: "auto", verticalContentAlignment: "Center", items: [ { type: "TextBlock", text: statusBadge, size: "Small", weight: "Bolder", color: badgeColor, wrap: false } ] }, { type: "Column", width: "stretch", items: [ { type: "TextBlock", text: title, size: "Medium", weight: "Bolder", color: badgeColor, wrap: true }, { type: "TextBlock", text: description, isSubtle: true, size: "Small", wrap: true, spacing: "None" } ] } ] }); }); } return [{ json: { type: "message", attachments: [{ contentType: "application/vnd.microsoft.card.adaptive", content: { $schema: "http://adaptivecards.io/schemas/adaptive-card.json", type: "AdaptiveCard", version: "1.4", body: [ { type: "ColumnSet", columns: [ { type: "Column", width: "auto", items: [ { type: "Image", url: "https://godotengine.org/assets/press/godot-logo.svg", size: "Small", altText: "Godot Logo" } ] }, { type: "Column", width: "stretch", verticalContentAlignment: "Center", items: [ { type: "TextBlock", text: "ADT Report : Tekton Dash", weight: "Bolder", size: "Large", color: "Accent" } ] } ] }, { type: "TextBlock", text: new Date().toLocaleDateString(), isSubtle: true, size: "Small", spacing: "None" }, ...taskBlocks, { type: "ActionSet", actions: [ { type: "Action.OpenUrl", title: "Open PR Game Dev", url: "https://www.notion.so/danchiego-game/36433be43b29800c8422ed5bdd65671b?v=36433be43b2980de8635000c0a910a0d", style: "positive" } ] } ] } }] } }];