Skip to content

Webhook system for deployment notifications#2379

Closed
A-D-E wants to merge 55 commits intoDokploy:canaryfrom
A-D-E:feature/deployment-webhooks
Closed

Webhook system for deployment notifications#2379
A-D-E wants to merge 55 commits intoDokploy:canaryfrom
A-D-E:feature/deployment-webhooks

Conversation

@A-D-E
Copy link
Contributor

@A-D-E A-D-E commented Aug 14, 2025

This MR implements a complete webhook system that enables real-time deployment notifications and integrations with external services.

🚀 Features Added

  • Webhook Management: Full CRUD operations for webhook configuration via UI and API
  • Multiple Event Types: Support for deployment lifecycle events (started, success, failed, cancelled)
  • Template System: Three payload formats - Generic JSON, Slack, and n8n optimized
  • Security: HMAC-SHA256 signature validation with optional secrets
  • Reliability: Retry mechanism with exponential backoff and delivery tracking
  • UI Components: Complete webhook management interface with delivery history

🔧 Technical Implementation

  • Database Schema: New webhook and webhook_deliveries tables
  • TRPC API: Comprehensive webhook router with 10+ endpoints
  • Service Integration: Webhooks triggered from deployment service lifecycle points
  • Error Handling: Robust retry logic and delivery status tracking
  • Testing: Unit tests covering validation and payload structure

📚 Documentation

  • Implementation Guide: Technical details, API usage, and security considerations
  • User Guide: Step-by-step setup instructions and troubleshooting
  • Integration Examples: Slack, n8n, and custom monitoring setups
  • Security Best Practices: HTTPS requirements and HMAC verification

🎯 Use Cases

  • DevOps notifications (Slack, email, PagerDuty)
  • Workflow automation (n8n, Zapier)
  • Monitoring system integration
  • Team collaboration tools (Jira, Trello, Microsoft Teams)

✅ Testing

  • Unit tests for webhook validation and payload structure
  • Manual testing procedures documented
  • Test webhook functionality built into UI

🔒 Security

  • HTTPS-only webhook endpoints
  • Optional HMAC-SHA256 signature validation
  • Custom headers support for authentication
  • Comprehensive error logging and monitoring

This implementation provides a solid foundation for deployment automation and team notifications while maintaining security and reliability standards.

A-D-E and others added 23 commits August 12, 2025 08:32
- Merged upstream canary branch to get latest v0.24.10
- Updated Node.js to 20.16.0 as required
- Fixed database schema with migrations
- Resolved dependency issues
- Add webhook and webhook_delivery database tables
- Implement complete webhook service with CRUD operations
- Add webhook triggering and delivery system
- Implement retry mechanism with exponential backoff
- Add template formatters for Slack and n8n
- Include HMAC signature generation for security
- Add delivery logging with 100-entry limit per webhook
- Add webhook triggering for deployment.started event in createDeployment
- Add webhook triggering for deployment.started event in createDeploymentCompose
- Enhance updateDeploymentStatus to trigger success/failed/cancelled webhooks
- Include full deployment context in webhook payloads
- Fire webhooks asynchronously to avoid blocking deployments
- Create webhook router with full CRUD operations
- Add endpoints for webhook testing and delivery history
- Include batch operations and statistics endpoints
- Add webhook toggle functionality
- Register webhook router in main API router
- Create webhook listing component with status indicators
- Add webhook form with support for Slack, n8n, and generic templates
- Implement webhook deliveries modal to show webhook history
- Add webhook management to application settings page
- Include test webhook functionality and delivery statistics
- Support enable/disable toggle and batch operations
- Add German (de) translation
- Add Spanish (es) translation
- Add French (fr) translation
- Add Portuguese (pt-br) translation
- Add Japanese (ja) translation
- Add Chinese Simplified (zh-Hans) translation
- Add Russian (ru) translation
- Add Italian (it) translation
- Add webhook and webhook_delivery database tables
- Implement complete webhook service with CRUD operations
- Add webhook triggering and delivery system
- Implement retry mechanism with exponential backoff
- Add template formatters for Slack and n8n
- Include HMAC signature generation for security
- Add delivery logging with 100-entry limit per webhook
- Remove remaining i18n references in webhook components
- Fix DOM nesting issue in delivery history table by removing Collapsible wrapper
- Use React.Fragment with key prop to fix React warning
- Fix modal closing issue by using onSelect with preventDefault
- Replace hardcoded English strings throughout webhook UI
These test files are already in .gitignore and should not be tracked.
…issues

- Split monolithic webhook components into modular, reusable pieces
- Created standalone WebhookForm component for create/edit operations
- Created dedicated WebhookHistoryModal for delivery history
- Created separate WebhookEditModal and WebhookCreateModal
- Fixed modal closing issues by removing conditional rendering
- Created custom WebhookDialog component without overscroll-contain issue
- Improved state management and separation of concerns
- Fixed all linting and TypeScript errors

This resolves the modal closing and scrolling issues that were preventing
proper webhook management functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Implement comprehensive n8n webhook template with flattened payload structure
- Add Slack Block Kit template with rich formatting and interactive components
- Create template configuration forms for both platforms
- Add template preview component with visual Slack message preview
- Implement template factory pattern for extensibility
- Add validation schemas for platform-specific configurations
- Create enhanced webhook service layer for integration

fix: remove automatic webhook secret generation

- Remove backend auto-generation of webhook secrets
- Fix form to properly handle undefined secrets
- Update edit modal to preserve null/undefined secret state
- Ensure users have full control over webhook secret management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@A-D-E A-D-E requested a review from Siumauricio as a code owner August 14, 2025 12:06
Copy link
Contributor

@Siumauricio Siumauricio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you implemented for applications and compose, but I cannot see for compose, can you check it?

Also if you can remove the unused .md files and remove the bun.lock files since we are using pnpm

Comment on lines +24 to +29
export const WebhookCreateModal = ({
applicationId,
composeId,
trigger,
onSuccess,
}: WebhookCreateModalProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the WebhookCreateModal and WebhookEditModal to handlewebhook? you can see examples where we handle the creation and the update in the same component, you can see the handle-project.tsx as an example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor: consolidate webhook modals into single handle-webhook component

…nent

- Create unified HandleWebhook component following handle-project pattern
- Replace WebhookCreateModal and WebhookEditModal with single component
- Update show-webhooks.tsx to use new HandleWebhook component
- Remove deprecated modal components
@A-D-E A-D-E force-pushed the feature/deployment-webhooks branch from 9e8bc46 to 8316222 Compare August 31, 2025 18:27
Siumauricio and others added 22 commits September 6, 2025 14:35
- Deleted 0106_mysterious_dracula.sql and 0106_nasty_silver_surfer.sql files containing webhook and webhook_delivery table definitions.
- Updated _journal.json to remove references to the deleted SQL files.
- Removed 0106_snapshot.json file as it is no longer needed.
…key constraints

- Created new SQL files for the 'webhook' and 'webhook_delivery' tables.
- Added columns and constraints to establish relationships between these tables and existing application and compose tables.
- Updated the journal to include the new migration version.
- Deleted SQL files for the 'webhook' and 'webhook_delivery' tables, along with their associated foreign key constraints.
- Updated _journal.json to reflect the removal of the migration version related to these tables.
- Cleaned up the project by removing obsolete snapshot files.
…key constraints

- Created new SQL tables for 'webhook' and 'webhook_delivery' to manage webhook events and their deliveries.
- Established foreign key relationships with the 'application' and 'compose' tables.
- Updated _journal.json to include the new migration version for tracking changes.
…event

- Removed the 'deployment.cancelled' event from the webhook events list.
- Updated type definitions for webhook handling to enforce stricter typing.
- Enhanced Slack template generation by removing the cancelled message logic.
- Cleaned up unused exports in webhook templates and services for better maintainability.
- Deleted the webhook basic validation test file as it is no longer needed.
- This cleanup helps streamline the test suite and maintain focus on relevant tests.
…bhook handling

- Eliminated the 'deployment.cancelled' event from the webhook schema and related logic.
- Adjusted type definitions in the deployment service to reflect the removal of the cancelled event.
- Cleaned up the payload formatting function by removing the generic case handling.
…ment.cancelled' event

- Continued the cleanup of the webhook schema by removing the 'deployment.cancelled' event from the validation logic.
- Updated the type definitions to ensure consistency and enforce stricter validation for webhook events.
- Deleted SQL files for the 'webhook' and 'webhook_delivery' tables, along with their associated foreign key constraints.
- Updated _journal.json to reflect the removal of the migration version related to these tables.
- Cleaned up the project by removing obsolete snapshot files.
- Created new tables 'webhook' and 'webhook_delivery' with necessary columns and constraints.
- Established foreign key relationships with 'application' and 'compose' tables.
- Updated journal and snapshot metadata for migration version 0121_dear_shooting_star.
Resolved migration conflicts by renumbering webhook migration from 0121 to 0131
Resolved migration conflicts by renumbering webhook migration from 0131 to 0133
@Siumauricio
Copy link
Contributor

Hello, @A-D-E. It is very likely that we will not proceed with this issue for now. Webhooks were recently implemented in notifications, which do almost the same thing as this, and later on I plan to review notifications so that they support when a deployment starts/ends, which is exactly what this PR does. I think adding it would mean removing it later on, so it wouldn't be ideal. I'll close this for now. Thank you very much for your work!

@Siumauricio Siumauricio closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants