added detailed handling of event types
Security / security (push) Successful in 1m10s

This commit is contained in:
2026-06-02 20:20:15 -05:00
parent e343545254
commit a3c65ecdef
+29 -1
View File
@@ -93,7 +93,35 @@ function Receive-Webhook
Write-Host "Payload: <empty>"
}
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