This commit is contained in:
@@ -93,7 +93,35 @@ function Receive-Webhook
|
|||||||
Write-Host "Payload: <empty>"
|
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 @{
|
Write-JsonResponse -Response $response -StatusCode 200 -Body @{
|
||||||
ok = $true
|
ok = $true
|
||||||
|
|||||||
Reference in New Issue
Block a user