Webhook Types
Infrahub supports three webhook types:Standard Webhook
Simple webhook that sends event data as-is:- Sends raw event payload
- No data transformation
- Minimal processing overhead
- Best for generic integrations
Custom Webhook
Webhook with custom payload structure:- Sends curated event data
- Configurable payload format
- Supports shared key signing
- Suitable for specific integrations
Transform Webhook
Webhook with Python transformation:- Executes Python transform before sending
- Full control over payload structure
- Can query Infrahub for additional data
- Most flexible option
Creating Webhooks
Using the UI
- Navigate to Integrations > Webhooks
- Click Add Webhook
- Configure:
- Name: Descriptive identifier
- URL: Destination endpoint
- Event Type: Trigger condition
- Branch Scope: Branch filter
- Node Kind: Optional node type filter
- Active: Enable/disable webhook
Using the SDK
Event Types
Webhooks can trigger on specific events:Node Events
infrahub.node.created: Node createdinfrahub.node.updated: Node updatedinfrahub.node.deleted: Node deleted
Branch Events
infrahub.branch.created: Branch createdinfrahub.branch.merged: Branch mergedinfrahub.branch.deleted: Branch deleted
Repository Events
infrahub.repository.created: Repository addedinfrahub.repository.updated: Repository updated
Wildcard
all: Match all events
Branch Scope
Filter events by branch:all_branches: All branches (default)default_branch: Only main branchother_branches: All branches except main
Webhook Payload
Standard Payload Structure
Event Context
Every webhook includes event context:Webhook Signing
Webhooks can be signed for security:Configure Shared Key
Signature Headers
Signed webhooks include these headers:Verify Signature
Transform Webhooks
Transform webhooks use Python to customize payloads:Create Transform
First, create a Python transform in a repository:Register Transform
Create Transform Webhook
Webhook Automation
Webhooks use Prefect automations for event triggering:Automation Creation
Auto-Configuration
Webhooks auto-configure when created/updated:Webhook Processing
Workflow Execution
Sending Webhook
Certificate Validation
Control SSL certificate validation:Webhook Models
Webhook Base Class
TransformWebhook
Real-World Examples
Slack Notifications
CI/CD Integration
Custom Monitoring
Best Practices
Security
- Always use HTTPS endpoints
- Enable certificate validation for public endpoints
- Use shared keys for sensitive integrations
- Rotate webhook secrets periodically
Performance
- Keep transform execution time short
- Use caching for frequently accessed data
- Implement retry logic in receiving systems
- Monitor webhook delivery success rates
Reliability
- Handle webhook failures gracefully
- Implement idempotency in receivers
- Validate webhook signatures
- Log all webhook deliveries
Troubleshooting
Webhook Not Firing
- Check webhook is
active: true - Verify event type matches
- Check branch scope filter
- Review node kind filter
- Check automation exists in Prefect
Delivery Failures
- Verify URL is accessible
- Check SSL certificate validity
- Review receiving endpoint logs
- Check for rate limiting
- Verify payload format
Transform Errors
- Test transform independently
- Check repository accessibility
- Verify Python syntax
- Review transform execution logs
- Check timeout settings