mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-18 03:20:26 +00:00
feat: add UUIDs and URLs to webhook notifications
- Add resource UUIDs (application_uuid, database_uuid, server_uuid, task_uuid) to all webhook notifications - Standardize URL field naming from various formats (resource_url, task_url, server_url) to consistent 'url' field - Include parent resource UUIDs for scheduled tasks (application_uuid or service_uuid) - Add direct URLs to Coolify resources for all notification types - Update UI to show "Webhook URL (POST)" label for clarity This enables webhook consumers to: - Uniquely identify resources using UUIDs used throughout Coolify UI - Directly link back to Coolify resource pages via the url field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -345,4 +345,47 @@ class ServerPatchCheck extends CustomEmailNotification
|
||||
color: SlackMessage::errorColor()
|
||||
);
|
||||
}
|
||||
|
||||
public function toWebhook(): array
|
||||
{
|
||||
// Handle error case
|
||||
if (isset($this->patchData['error'])) {
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => 'Failed to check patches',
|
||||
'event' => 'server_patch_check_error',
|
||||
'server_name' => $this->server->name,
|
||||
'server_uuid' => $this->server->uuid,
|
||||
'os_id' => $this->patchData['osId'] ?? 'unknown',
|
||||
'package_manager' => $this->patchData['package_manager'] ?? 'unknown',
|
||||
'error' => $this->patchData['error'],
|
||||
'url' => $this->serverUrl,
|
||||
];
|
||||
}
|
||||
|
||||
$totalUpdates = $this->patchData['total_updates'] ?? 0;
|
||||
$updates = $this->patchData['updates'] ?? [];
|
||||
|
||||
// Check for critical packages
|
||||
$criticalPackages = collect($updates)->filter(function ($update) {
|
||||
return str_contains(strtolower($update['package']), 'docker') ||
|
||||
str_contains(strtolower($update['package']), 'kernel') ||
|
||||
str_contains(strtolower($update['package']), 'openssh') ||
|
||||
str_contains(strtolower($update['package']), 'ssl');
|
||||
});
|
||||
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => 'Server patches available',
|
||||
'event' => 'server_patch_check',
|
||||
'server_name' => $this->server->name,
|
||||
'server_uuid' => $this->server->uuid,
|
||||
'total_updates' => $totalUpdates,
|
||||
'os_id' => $this->patchData['osId'] ?? 'unknown',
|
||||
'package_manager' => $this->patchData['package_manager'] ?? 'unknown',
|
||||
'updates' => $updates,
|
||||
'critical_packages_count' => $criticalPackages->count(),
|
||||
'url' => $this->serverUrl,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user