From a3c65ecdef71b24805a3289d3e15bcb860e66f25 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Reardon Date: Tue, 2 Jun 2026 20:20:15 -0500 Subject: [PATCH] added detailed handling of event types --- Start-DoneTickConsumer.ps1 | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Start-DoneTickConsumer.ps1 b/Start-DoneTickConsumer.ps1 index a91b22d..71246ed 100644 --- a/Start-DoneTickConsumer.ps1 +++ b/Start-DoneTickConsumer.ps1 @@ -93,7 +93,35 @@ function Receive-Webhook Write-Host "Payload: " } - Send-AppriseNotification -title "Donetick Webhook Received" -content "$($payload.type) $($payload.data.chore.name)" + $notificationTitle = "" + $notificationContent = "" + switch($payload.type) + { + "task.completed" { + $notificationTitle = "Donetick Task Completed" + $notificationContent = "$($payload.data.chore.name) marked completed!" + } + "task.reminder" { + $notificationTitle = "Donetick Task Reminder" + $notificationContent = "$($payload.data.name) is due at $(Get-Date $payload.data.due_date)" + } + "task.created" { + $notificationTitle = "Donetick Task Created" + if ($null -ne $payload.data.chore.nextDueDate) + { + $notificationContent = "$($payload.data.chore.name) created" + } + else + { + $notificationContent = "$($payload.data.chore.name) created with due date of $(Get-Date $payload.data.chore.nextDueDate)" + } + } + default { + $notificationTitle = "Donetick Notification" + $notificationContent = "Donetick event of type $($payload.type) received" + } + } + Send-AppriseNotification -title $notificationTitle -content $notificationContent Write-JsonResponse -Response $response -StatusCode 200 -Body @{ ok = $true