CAPYSQUASH

Notification Rules

Smart, flexible event-based notification system

NOTIFICATION RULES

Notification Rules provide flexible, event-based notifications delivered via multiple channels with conditional logic.

Keep your team informed automatically with smart notification rules

OVERVIEW

Create custom rules that trigger notifications based on specific events and conditions.

Key Features:

  • Event-based triggers - Analysis complete, warnings detected, usage limits
  • Conditional logic - Only notify if certain conditions are met
  • Multi-channel delivery - Email, Slack, webhooks, in-app
  • Role-based targeting - Notify specific users or roles
  • Custom templates - Personalize notification messages
  • Test before enabling - Verify rules work as expected

CREATING A RULE

CREATE NOTIFICATION RULE

1

NAVIGATE TO NOTIFICATIONS

Dashboard → Organization Settings → Notification Rules

2

CONFIGURE TRIGGER

  • ► Name your rule
  • ► Select event type
  • ► Set conditions (optional)
  • ► Choose projects (or all)
3

CHOOSE DELIVERY

  • ► Email, Slack, or webhook
  • ► Select recipients
  • ► Customize message (optional)
4

TEST & ENABLE

Test rule with sample data, then enable

SUPPORTED EVENTS

Analysis Events

analysis.completed

  • Trigger: Analysis finishes successfully
  • Use case: Notify team when consolidation results are ready
  • Data available: Reduction percentage, warnings, time saved

analysis.failed

  • Trigger: Analysis encounters an error
  • Use case: Alert engineers when something breaks
  • Data available: Error message, project name, user who ran it

migration.warnings

  • Trigger: Analysis detects warnings above threshold
  • Use case: Flag potentially dangerous migrations
  • Data available: Warning count, warning messages, affected migrations

Usage Events

usage.limit.warning

  • Trigger: Approaching usage limit (80%, 90%, 95%)
  • Use case: Warn before hitting limits
  • Data available: Current usage, limit, percentage

usage.limit.exceeded

  • Trigger: Usage limit reached (100%)
  • Use case: Alert admins immediately
  • Data available: Which limit exceeded, current usage

Team Events

team.member_added

  • Trigger: New member joins organization
  • Use case: Notify admins of team changes
  • Data available: New member email, role, who invited them

team.member_removed

  • Trigger: Member leaves or is removed
  • Use case: Track team changes for security
  • Data available: Member email, who removed them

team.role_changed

  • Trigger: Member's role is modified
  • Use case: Monitor permission changes
  • Data available: Member email, old role, new role

Project Events

project.created

  • Trigger: New project created
  • Use case: Keep team informed of new projects
  • Data available: Project name, creator, settings

project.deleted

  • Trigger: Project is permanently deleted
  • Use case: Audit trail for deletions
  • Data available: Project name, who deleted it

Subscription Events

subscription.changed

  • Trigger: Plan upgraded or downgraded
  • Use case: Track billing changes
  • Data available: Old plan, new plan, effective date

subscription.cancelled

  • Trigger: Subscription cancelled
  • Use case: Alert admins of cancellation
  • Data available: Plan name, cancellation date

subscription.payment_failed

  • Trigger: Payment failed
  • Use case: Urgent notification to fix payment
  • Data available: Amount, failure reason

CONDITIONS

Add conditional logic to filter when notifications trigger:

Comparison Operators

  • equals / not_equals - Exact match
  • greater_than / gte - Numeric comparison
  • less_than / lte - Numeric comparison
  • contains / not_contains - String matching
  • starts_with / ends_with - String prefix/suffix
  • in / not_in - Array membership

Available Fields

Depends on event type:

For analysis.completed:

  • reduction_percentage - Percentage of files reduced
  • warning_count - Number of warnings
  • original_count - Original file count
  • optimized_count - Optimized file count
  • project_id - Which project
  • safety_level - Which safety level used

For usage.limit.warning:

  • limit_type - "projects", "analyses", "storage"
  • percentage - Current usage percentage
  • used - Current usage amount
  • limit - Maximum allowed

For team.member_added:

  • role - New member's role
  • email - New member's email domain

Example Conditions

{
  "event_type": "analysis.completed",
  "conditions": {
    "warning_count": {
      "gte": 5
    }
  }
}

Triggers: Only when analysis has 5+ warnings

{
  "event_type": "analysis.completed",
  "conditions": {
    "reduction_percentage": {
      "lt": 30
    }
  }
}

Triggers: Only when reduction is less than 30%

{
  "event_type": "analysis.completed",
  "conditions": {
    "project_id": {
      "equals": "proj_xyz123"
    }
  }
}

Triggers: Only for specific project

{
  "event_type": "analysis.completed",
  "conditions": {
    "project_name": {
      "contains": "production"
    }
  }
}

Triggers: Only for projects with "production" in name

DELIVERY CHANNELS

Email

Send notifications via email.

Configuration:

  • Recipients: Select users, roles, or enter custom emails
  • Subject: Custom subject line (supports variables)
  • Message: Custom HTML or plain text body

Example:

To: admins@company.com, developers@company.com
Subject: ⚠️ {{project_name}} analysis found {{warning_count}} warnings
Message: Analysis complete! Check the dashboard for details.

Slack

Post to Slack channels via webhook.

Configuration:

  • Webhook URL: Your Slack incoming webhook URL
  • Channel: Optional channel override
  • Username: Bot display name
  • Icon: Bot icon emoji or URL
  • Message: Custom message (supports Slack formatting)

Setup:

  1. Create Slack incoming webhook
  2. Copy webhook URL
  3. Paste into notification rule
  4. Test notification

Example message:

⚡ Analysis complete for *{{project_name}}*

📊 Results:
► Original: {{original_count}} files
► Optimized: {{optimized_count}} files
► Reduction: {{reduction_percentage}}%
⚠️ Warnings: {{warning_count}}

<{{dashboard_url}}|View Dashboard →>

Webhook

Send HTTP POST to custom endpoint.

Configuration:

  • URL: Your webhook endpoint
  • Headers: Custom headers (e.g., authorization)
  • Payload: JSON body (supports variables)
  • Timeout: Max wait time (default: 5s)
  • Retry: Retry on failure (optional)

Payload example:

{
  "event": "analysis.completed",
  "timestamp": "2025-10-20T15:30:00Z",
  "organization_id": "org_xyz",
  "data": {
    "project_id": "proj_123",
    "project_name": "{{project_name}}",
    "reduction_percentage": {{reduction_percentage}},
    "warning_count": {{warning_count}},
    "dashboard_url": "{{dashboard_url}}"
  }
}

In-App

Show notification in dashboard.

Configuration:

  • Recipients: Select users or roles
  • Priority: Normal, High, Urgent
  • Action: Optional link to relevant page

Appearance:

  • Notification bell icon shows unread count
  • Clicking opens notification panel
  • Notifications auto-mark as read

RECIPIENTS

Targeting Options

By User:

  • Select specific team members
  • Enter email addresses directly
  • Supports external emails

By Role:

  • admins - All organization admins
  • members - All organization members
  • viewers - All viewers
  • owners - Organization owners only

By Project:

  • All project members
  • Project admins only
  • Project creator

Multiple Recipients

You can combine targeting methods:

Example:

Recipients:
☑ Role: Admins
☑ User: jane@company.com
☑ External: devops@company.com

All recipients receive the same notification.

MESSAGE TEMPLATES

Available Variables

Use {{variable}} syntax in messages:

Common variables:

  • {{organization_name}} - Your organization name
  • {{project_name}} - Project name
  • {{project_id}} - Project ID
  • {{user_name}} - User who triggered event
  • {{user_email}} - User's email
  • {{timestamp}} - Event timestamp
  • {{dashboard_url}} - Link to dashboard

Analysis-specific:

  • {{original_count}} - Original file/statement count
  • {{optimized_count}} - Optimized count
  • {{reduction_percentage}} - Reduction %
  • {{warning_count}} - Number of warnings
  • {{safety_level}} - Safety level used
  • {{processing_time}} - How long analysis took

Usage-specific:

  • {{limit_type}} - Type of limit (projects/analyses)
  • {{used}} - Current usage
  • {{limit}} - Maximum allowed
  • {{percentage}} - Usage percentage

Template Examples

Subject: ☑ {{project_name}} analysis complete

Great news! Analysis finished successfully.

Results:
► Reduction: {{reduction_percentage}}%
► Original: {{original_count}} files
► Optimized: {{optimized_count}} files
► Warnings: {{warning_count}}

View full report: {{dashboard_url}}
Subject: ⚠️ {{project_name}} has {{warning_count}} warnings

Analysis detected potential issues:

► Project: {{project_name}}
► Warnings: {{warning_count}}
► Safety level: {{safety_level}}
► Ran by: {{user_name}}

Review warnings: {{dashboard_url}}
Subject: 🚨 Usage limit warning - {{percentage}}%

You're approaching your {{limit_type}} limit:

► Used: {{used}}
► Limit: {{limit}}
► Percentage: {{percentage}}%

Consider upgrading: {{billing_url}}
Subject: 👤 New team member: {{user_name}}

{{user_name}} ({{user_email}}) joined your organization.

► Role: {{role}}
► Invited by: {{inviter_name}}
► Date: {{timestamp}}

Manage team: {{team_url}}

TESTING RULES

Before enabling, test your notification rule:

  1. Click "Test Rule"
  2. Select sample event or provide test data
  3. Notification sent to you only (not actual recipients)
  4. Verify message appears correctly
  5. Adjust and test again if needed

Test data example:

{
  "project_name": "Test Project",
  "reduction_percentage": 75,
  "warning_count": 3,
  "original_count": 100,
  "optimized_count": 25
}

MANAGING RULES

Enable/Disable

Toggle rules on/off without deleting:

Enabled: ☑ Rule active, notifications sent Disabled: ⏸️ Rule inactive, no notifications

Use case: Temporarily disable noisy rules without losing configuration

Edit Rules

Modify existing rules:

  1. Click rule to edit
  2. Change any settings
  3. Test again
  4. Save changes

Effect: Changes apply immediately to future events

Delete Rules

Permanently remove a rule:

  1. Click rule to edit
  2. Click "Delete Rule"
  3. Confirm deletion

Effect: Rule deleted, no more notifications

Rule History

View notification history:

Information shown:

  • When rule last triggered
  • How many times triggered (last 30 days)
  • Recent notifications sent
  • Delivery status (success/failed)
  • Error messages if failed

COMMON USE CASES

1. Critical Warnings Alert

Goal: Immediately notify admins of dangerous migrations

{
  "name": "Critical Migration Warnings",
  "event_type": "migration.warnings",
  "conditions": {
    "warning_count": { "gte": 5 }
  },
  "notify_roles": ["admin", "owner"],
  "send_email": true,
  "send_slack": true,
  "priority": "urgent"
}

2. Production Analysis Complete

Goal: Notify team when production analysis finishes

{
  "name": "Production Analysis Done",
  "event_type": "analysis.completed",
  "conditions": {
    "project_name": { "contains": "production" }
  },
  "notify_roles": ["admin", "member"],
  "send_email": true,
  "email_subject": "☑ Production analysis complete"
}

3. Low Reduction Warning

Goal: Flag analyses with poor consolidation

{
  "name": "Low Reduction Alert",
  "event_type": "analysis.completed",
  "conditions": {
    "reduction_percentage": { "lt": 30 }
  },
  "notify_users": ["tech-lead@company.com"],
  "send_email": true
}

4. Usage Limit Approaching

Goal: Warn before hitting subscription limits

{
  "name": "Usage Limit Warning",
  "event_type": "usage.limit.warning",
  "conditions": {
    "percentage": { "gte": 80 }
  },
  "notify_roles": ["owner"],
  "send_email": true,
  "priority": "high"
}

5. Team Changes Audit

Goal: Track all team membership changes

{
  "name": "Team Change Notification",
  "event_type": "team.member_added",
  "notify_roles": ["admin"],
  "send_email": true,
  "send_webhook": true,
  "webhook_url": "https://audit-system.company.com/webhook"
}

BEST PRACTICES

NOTIFICATION BEST PRACTICES

☑ DO

  • ► Use conditions to reduce noise
  • ► Test rules before enabling
  • ► Use clear, actionable subject lines
  • ► Include relevant links in messages
  • ► Target appropriate recipients
  • ► Use variables for dynamic content
  • ► Set up critical alerts first

☒ DON'T

  • ► Create rules without conditions (too noisy)
  • ► Send everything to everyone
  • ► Use vague subject lines
  • ► Forget to test rules
  • ► Enable too many rules at once
  • ► Ignore failed delivery notifications

Notification Fatigue

Avoid overwhelming your team:

Good:

  • Critical events → Immediate email/Slack
  • Routine events → Daily digest
  • Low priority → In-app only

Bad:

  • Every event → Immediate email
  • No conditions → Constant noise
  • Too many rules → Alert fatigue

TROUBLESHOOTING

Email Not Delivered

Possible causes:

  • Recipient email invalid
  • Email marked as spam
  • SMTP delivery failed

Solutions:

  • Verify email addresses
  • Check spam folder
  • Add noreply@capysquash.dev to contacts
  • Contact support if persistent

Slack Notification Failed

Possible causes:

  • Invalid webhook URL
  • Webhook deleted in Slack
  • Network timeout
  • Slack API down

Solutions:

  • Verify webhook URL is correct
  • Test webhook in Slack settings
  • Create new webhook if needed
  • Check Slack status page

Webhook Timeout

Possible causes:

  • Endpoint too slow (>5s)
  • Network issues
  • Endpoint down

Solutions:

  • Optimize endpoint response time
  • Increase timeout setting
  • Check endpoint is accessible
  • Add retry logic

Rule Not Triggering

Possible causes:

  • Conditions too restrictive
  • Rule disabled
  • Event type doesn't match
  • Bug in condition logic

Solutions:

  • Check rule is enabled
  • Review conditions carefully
  • Test with sample data
  • Simplify conditions temporarily

LIMITATIONS

PlanRules AllowedDelivery Channels
Free0N/A
Creator3 rulesEmail only
Professional10 rulesEmail, Slack, Webhook
Agency25 rulesAll channels
EnterpriseUnlimitedAll channels + Custom

NEXT STEPS

How is this guide?

On this page