Creating Notification Templates
Template System: RunReveal uses Handlebars-style templating (via Raymond) to create dynamic notifications that adapt to your detection data.

Template Syntax Guide
Use fieldName syntax to insert dynamic values. Most fields are under detection for both scheduled and streaming detections.
Full markdown support including:
Overview
Notification templates allow you to customize how alerts are formatted and delivered across different channels. Templates support conditional logic, data iteration, markdown rendering, and channel-specific formatting.
Using the Template Builder
RunReveal provides a visual template builder in the dashboard to create and manage your notification templates.
🛠️ Quick Start: Creating Your First Template
Step-by-Step Guide
Navigate to Notification Channels in the RunReveal dashboard, then click on the Templates tab.
Path: Dashboard → Notification Channels → Templates
Click the Create Template button. Give your template a descriptive name that reflects its purpose (e.g., "Critical Security Alert", "Daily Digest Summary").
Enter your title template in the Title field. This appears as the email subject line or message header. Keep it concise and include key information like severity and detection name.
[{{detection.severity}}] {{detection.displayName}} - {{detection.resultCount}} results
Enter your body template in the Body field. This is the main content of your notification. Use Handlebars syntax for dynamic content, markdown for formatting, and helpers for advanced features.
{{detection.name}}{{#ifEquals...}}{{table results}}The template editor shows a Preview of how your markdown and formatting will render. Note that the preview displays your template structure with placeholder values—it does not use real detection data.
Testing with Real Data: To see your template with actual detection data, use the Send Test button on your notification channel after saving the template. This sends a test notification using sample detection data to your configured destination (Slack, email, etc.).
- ✓ Markdown rendering
- ✓ Template structure
- ✓ Formatting validation
- ✓ Real variable substitution
- ✓ Conditional logic evaluation
- ✓ Channel-specific formatting
Click Save Template to create your template. Then assign it to detections by editing the detection and selecting your template from the Notification Template dropdown.
💡 Tip: You can also specify templates in Detection-as-Code using the notificationTemplate field.
Assigning Templates to Detections
- Go to Detections → Detection Queries
- Edit the detection you want to customize
- Find the "Notification Template" dropdown
- Select your custom template
- Save the detection
Template Structure
Templates consist of two parts:
📌 Title Template
📄 Body Template
Core Concepts
Inserting Dynamic Values
Access detection properties using dot notation. Variables are wrapped in double curly braces.
Basic Syntax
detection.displayNamedetection.severitydetection.riskScoredetection.resultLink2. Conditional Logic
Conditional helpers allow you to show or hide content based on detection properties.
Comparison Helpers
Equality Checks
ifEquals- Check if values are equalifNotEquals- Check if values differ
Numeric Comparisons
ifGreaterThan- Greater thanifLessThan- Less thanifGreaterThanOrEqual- Greater or equal
String Operations
ifContains- String containsifStartsWith- String starts withifEndsWith- String ends with
Empty Checks
ifNotEmpty- Value existsifEmpty- Value is empty
💡 Example Use Cases
- • Show critical alert banner only when severity equals "Critical"
- • Display high-risk warning when risk score is greater than 80
- • Show error message only when detection.error is not empty
- • Customize content based on channel type (email vs Slack)
3. Data Iteration
Loop through detection results and arrays to display multiple items.
Loop Helper
Basic Loop Structure
Common Patterns
- • Loop through detection results
- • Iterate over categories array
- • Process MITRE techniques
- • Display extracted fields
Best Practices
- • Always check ifNotEmpty before looping
- • Use index for numbering items
- • Use first/last for special formatting
- • Limit display to first N items if needed
4. Table Generation
Automatically format detection results as tables for better readability.
Auto-Detect Columns
table detection.resultsSpecify Columns
tableWithColumns detection.results "col1" "col2"5. Markdown Rendering
Convert markdown content to HTML for rich formatting in your notifications.
📝 Markdown Support
Supported Markdown Features
Template Organization Patterns
Pattern 1: Severity-Based Styling
Organize content based on detection severity levels.
Pattern 2: Risk Score Visualization
Display risk scores with visual indicators.
Risk Score Ranges
Pattern 3: Result Organization
Structure detection results for clarity.
Recommended Structure
- 1Summary SectionDetection name, severity, risk score, result count
- 2Results TableFormatted table of detection results
- 3Detailed AnalysisLoop through results for detailed view
- 4Action ItemsInvestigation steps and quick links
Template Variables Reference
Detection Object Properties
| Property | Type | Description |
|---|---|---|
| detection.id | string | Unique execution ID |
| detection.displayName | string | Human-readable detection name |
| detection.severity | string | Severity level (Critical, High, Medium, Low) |
| detection.riskScore | number | Risk score (0-100) |
| detection.resultCount | number | Number of results found |
| detection.results | array | Query results (array of objects) |
| detection.resultLink | string | URL to view full results |
| detection.categories | array | Category tags |
| detection.error | string | Error message if execution failed |
Channel Variable
channel - The notification channel type (email, slack, discord, webhook, jira, pagerduty, linear, google-chat)
Best Practices
✅ Do
- • Keep titles concise (50-100 characters)
- • Always check ifNotEmpty before iterating
- • Include error handling sections
- • Provide investigation steps
- • Link to full results
- • Test with empty results
- • Use markdown for rich formatting
❌ Don't
- • Assume results always exist
- • Create overly long titles
- • Skip error handling
- • Hard-code values that should be dynamic
- • Forget to test edge cases
- • Use complex nested conditionals unnecessarily
- • Ignore channel-specific formatting needs
Ready-to-Use Templates
Copy & Paste Ready: Each template below can be copied directly into RunReveal's notification template editor. Templates demonstrate different features of the Handlebars templating system.
A simple template demonstrating basic variable substitution. Use double curly braces to insert detection properties like name, severity, and risk score.
[{{detection.severity}}] {{detection.displayName}}- ✓ Simple variable syntax
- ✓ Dot notation for nested properties
- ✓ Markdown formatting support
Title:
Body:
Use ifEquals to show different content based on severity level. Great for adding visual indicators and urgency messaging.
Title:
Body:
The table helper automatically formats detection results as a markdown table. Use tableWithColumns to specify which columns to display.
table detection.resultstableWithColumns detection.results "user" "action"Title:
Body:
Use #each to iterate through arrays. Access the current item with this, index with @index, and object keys with @key.
Title:
Body:
Use numeric comparison helpers to create threshold-based messaging. Combine ifGreaterThan and ifLessThan for range checks.
Low Risk
Elevated
High Risk
Title:
Body:
The channel variable indicates the notification destination. Use it to format messages appropriately for each platform.
Title:
Body:
Always check for errors using ifNotEmpty detection.error. This ensures users are notified when detections fail and provides clear troubleshooting guidance.
Title:
Body:
Testing Your Templates
Test Scenarios
Data Variations
- • Empty results (resultCount = 0)
- • Single result
- • Multiple results (10+)
- • Missing optional fields
Severity & Risk
- • High risk scores (above 80)
- • Low risk scores (below 20)
- • Different severity levels
- • Error conditions
Related Documentation
- Notification Channels - Configure and manage notification channels
- Detections - Create and manage detection rules
- Writing Detections - Learn how to write effective detections
- Detection as Code - Manage detections with version control