A webhook middleware that transforms any payloads to work with the Brrr API.
Let-It-Brrr receives webhooks from various sources, transforms their payloads using customizable mappings, and forwards them to the Brrr notification API. This allows you to integrate any webhook source with Brrr without modifying your existing systems.
- Customizable Payload Mapping: Define how incoming payloads should be transformed to match Brrr's expected format.
- Conditional Value Assignment: Dynamically assign field values based on
webhook payload content (e.g., set interruption level to
criticalwhen the message contains "urgent"). - Default Values: Set default values for fields that may not be present in the incoming payload.
docker pull ghcr.io/thisisbenny/let-it-brrr:latestCreate a mappings.yaml file:
mappings:
my-fluxcd-alerts:
brrr_fields:
- field_expression: "message"
target_field: "message"
- field_expression: "involvedObject.name"
target_field: "subtitle"
default_values:
title: "FluxCD Alert"docker run -d \
--name let-it-brrr \
-p 8080:8080 \
-e BRRR_SECRET=your_brrr_secret_here \
-v ./mappings.yaml:/app/config/mappings.yaml \
ghcr.io/thisisbenny/let-it-brrr:latestSend a test webhook:
curl -X POST http://localhost:8080/webhook/my-fluxcd-alerts \
-H "Content-Type: application/json" \
-d '{"message": "Deployment successful", "involvedObject": {"name": "my-app"}}'ghcr.io/thisisbenny/let-it-brrr
| Tag | Description |
|---|---|
latest |
Most recent release |
v*.*.* |
Specific semantic version (e.g., v0.1.0) |
linux/amd64linux/arm64
| Variable | Required | Default | Description |
|---|---|---|---|
BRRR_SECRET |
Yes | - | Secret for Brrr API authentication |
MAPPINGS_FILE |
No | /app/config/mappings.yaml |
Path to mappings configuration |
LOG_LEVEL |
No | INFO |
Logging level (DEBUG, INFO, WARN, ERROR) |
The mappings.yaml file defines how webhook payloads are transformed:
mappings:
<mapping-id>:
brrr_fields:
- field_expression: "json.path.to.field" # JSON path or template in incoming webhook
target_field: "target_field_name" # Field name for Brrr API
- field_expression: "prefix - {{otherField}}" # Template with {{}} embedding
target_field: "target_field_name" # Result field name for Brrr API
default_values:
<field_name>: <default_value> # Fallback if field_expression result is emptyTemplate Syntax: Use {{jsonPath}} within target_field to embed dynamic
values from the webhook payload.
target_field: "prefix - {{involvedObject.name}}"
# Result if involvedObject.name = "my-app": "prefix - my-app"You can dynamically assign values to fields based on webhook payload content
using the when condition:
- target_field: "<target_field_name>"
when:
field: "json.path.to.field" # Dot-path into source payload
contains: "substring" # Case-insensitive substring to match
value: "<static_value>" # Value to assign when condition matchesHow it works:
- The
when.fieldpath is resolved against the incoming payload (supports dot-notation for nested fields) - If the resolved value contains
when.contains(case-insensitive), thevalueis assigned totarget_field - Multiple rules for the same
target_fielduse first-match-wins (rules are evaluated in order, first matching rule wins) default_valuesserves as fallback when no rule matches
mappings:
fluxcd-generic:
brrr_fields:
- field_expression: "message"
target_field: "message"
- field_expression: "FluxCD - {{involvedObject.kind}}"
target_field: "title"
- field_expression: "involvedObject.name"
target_field: "subtitle"
- target_field: "interruption_level"
when:
field: "message"
contains: "critical"
value: "critical"
- target_field: "interruption_level"
when:
field: "message"
contains: "error"
value: "time-sensitive"
- target_field: "interruption_level"
when:
field: "involvedObject.kind"
contains: "Kustomization"
value: "time-sensitive"
default_values:
title: "FluxCD"
interruption_level: "active" # fallback when no condition matchesHealth check endpoint.
Response:
{ "status": "ok", "mappings_count": 2, "version": "1.0.0" }Fields:
status- Always "ok" when healthymappings_count- Number of configured mappingsversion- Application version (from git tag or "0.0.0" if not available)
Receive and transform webhooks.
Path Parameters:
mappingId- The mapping configuration to use
Request:
Content-Type: application/json- Body: Webhook payload
Response:
{ "status": "forwarded", "mapping_id": "my-mapping" }Error Responses:
400- Invalid JSON or missing Content-Type404- Mapping not found502- Brrr API error
Important: Let-It-Brrr does not have built-in authentication. The service is designed to be deployed behind network protection layers and should never be exposed directly to the internet without additional security measures.
To safely deploy Let-It-Brrr, use one or more of the following protection mechanisms:
- Network Restrictions: Deploy behind a firewall or VPN to limit access to trusted networks only
- Reverse Proxy with Authentication: Place a reverse proxy (such as nginx, Traefik, or Cloudflare Tunnel) in front of Let-It-Brrr that handles authentication
- IP Allowlisting: Configure firewall rules to only allow incoming webhooks from known IP addresses
Mapping IDs (the <mapping-id> in webhook URLs) act as a minimal form of
security through obscurity. Use randomly generated, unpredictable mapping
IDs (e.g., UUIDs) rather than descriptive names like my-fluxcd-alerts.
Example of a secure mapping ID:
mappings:
a7f3b2c1-9e45-4d8f-b123-456789abcdef:
brrr_fields:
- field_expression: "message"
target_field: "message"
default_values:
title: "Alert"Do NOT use predictable mapping IDs that could be guessed by unauthorized parties.
Contributions are welcome! Please feel free to submit issues or pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
deno testdeno lintThis project is licensed under the MIT License - see the LICENSE file for details.