Skip to content

Discord Integration

Discord integration allows you to receive 9n9s alerts directly in your Discord channels with rich embeds, color coding, and role mentions for your community or team.

  1. Create Discord Webhook

    • Go to your Discord server settings
    • Navigate to IntegrationsWebhooks
    • Click “Create Webhook” or “New Webhook”
    • Configure the webhook settings
  2. Configure in 9n9s

    • Go to Organization Settings > Notification Channels
    • Click “Add Channel”“Discord”
    • Enter your webhook URL and customize settings
    • Click “Create Channel”
  3. Test Integration

    • Click “Send Test Message”
    • Verify message appears in Discord channel
    • Check formatting and mentions
  • Admin Permissions: You need “Manage Webhooks” permission in the Discord server
  • Channel Access: Target channel must allow webhook integrations
  • Server Type: Works with all Discord server types (community, private, etc.)
  • Organization Admin: Admin role to configure notification channels
  • Active Subscription: Discord integration available on all plans
  1. Access Server Settings

    • Right-click your Discord server name
    • Select “Server Settings”
    • Navigate to “Integrations” in the left sidebar
  2. Create New Webhook

    • Click “Webhooks” tab
    • Click “Create Webhook” button
    • This opens the webhook configuration
  3. Configure Webhook

    • Name: “9n9s Alerts” (or your preferred name)
    • Channel: Select target channel (e.g., #alerts, #monitoring)
    • Avatar: Upload 9n9s logo or custom image (optional)
  4. Copy Webhook URL

    • Click “Copy Webhook URL”
    • Save this URL securely for 9n9s configuration
  1. Navigate to Notification Channels

    • Log into app.9n9s.com
    • Go to Organization Settings
    • Click “Notification Channels”
  2. Create Discord Channel

    • Click “Add Channel” button
    • Select “Discord” from integration types
    • Enter webhook configuration details
  3. Channel Configuration

    • Channel Name: “Discord Alerts” (internal reference)
    • Webhook URL: Paste the Discord webhook URL
    • Username: “9n9s Monitor” (appears as message sender)
    • Avatar URL: Custom avatar URL (optional)
  1. Embed Configuration

    • Rich Embeds: Enable Discord embed formatting
    • Color Coding: Automatic colors based on alert severity
    • Thumbnail: Include 9n9s logo or status indicators
    • Footer: Add timestamp and monitor information
  2. Mention Settings

    • Role Mentions: Configure which roles to mention
    • User Mentions: Specific user mentions for critical alerts
    • @everyone/@here: Use sparingly for critical incidents only
    • Mention Conditions: When to use mentions (critical only, all alerts, etc.)

Discord messages use rich embeds with the following structure:

Critical Alert Example:

{
"embeds": [
{
"title": "🚨 CRITICAL: API Health Check",
"description": "Monitor is DOWN (was UP)",
"color": 15158332,
"fields": [
{
"name": "Duration",
"value": "5 minutes",
"inline": true
},
{
"name": "Environment",
"value": "production",
"inline": true
},
{
"name": "Project",
"value": "Core Services",
"inline": true
}
],
"footer": {
"text": "9n9s Monitoring",
"icon_url": "https://9n9s.com/logo.png"
},
"timestamp": "2024-01-15T14:30:00Z"
}
]
}

Embeds automatically use color coding based on alert severity:

  • 🟢 Green (3066993): UP, Recovered, Resolved
  • 🟡 Yellow (16776960): DEGRADED, Warning, Late
  • 🔴 Red (15158332): DOWN, Critical, Failed
  • 🔵 Blue (3447003): Maintenance, Scheduled
  • ⚫ Gray (9807270): Paused, Unknown

Configure role mentions for different alert types:

mention_config:
critical_alerts:
roles: ["@DevOps", "@On-Call"]
conditions: ["status:DOWN", "criticality:high"]
standard_alerts:
roles: ["@Monitoring"]
conditions: ["status:DEGRADED"]
recovery_notifications:
roles: [] # No mentions for recovery
conditions: ["status:UP"]

Set up different Discord channels for different alert types:

  1. Critical Alerts Channel

    • Channel: #critical-alerts
    • Mentions: @here for immediate attention
    • Conditions: criticality=critical
  2. General Alerts Channel

    • Channel: #alerts
    • Mentions: @Monitoring role
    • Conditions: All other alerts
  3. Team-Specific Channels

    • Channel: #backend-alerts
    • Mentions: @Backend role
    • Conditions: team=backend

For advanced use cases, you can configure webhook details:

{
"webhook_url": "https://discord.com/api/webhooks/...",
"username": "9n9s Alerts",
"avatar_url": "https://9n9s.com/assets/discord-avatar.png",
"embeds": true,
"rate_limit": {
"messages_per_minute": 30,
"burst_limit": 5
},
"retry_config": {
"max_retries": 3,
"retry_delay": "5s"
}
}

For more advanced features, you can create a Discord bot:

  1. Create Discord Application

  2. Configure Bot Permissions

    • Send Messages
    • Embed Links
    • Use Slash Commands (optional)
  3. Integration Benefits

    • Interactive buttons (acknowledge, snooze)
    • Slash commands for status checks
    • Enhanced permission control
  1. URL Protection

    • Keep webhook URLs confidential
    • Regenerate if compromised
    • Use HTTPS-only webhooks
  2. Permission Management

    • Limit webhook creation permissions
    • Regular audit of active webhooks
    • Remove unused webhooks promptly
  1. Rate Limiting

    • Discord has rate limits (30 messages per minute)
    • 9n9s automatically handles rate limiting
    • Configure burst settings appropriately
  2. Content Guidelines

    • Follow Discord’s Terms of Service
    • Avoid spam or excessive mentions
    • Keep messages concise but informative

Messages Not Appearing:

  1. Check Webhook URL

    • Verify URL is correct and active
    • Test webhook with Discord’s webhook tester
    • Ensure webhook hasn’t been deleted
  2. Permission Issues

    • Verify bot/webhook has message permissions
    • Check channel permissions
    • Ensure server allows webhooks

Rate Limiting:

  1. Too Many Messages

    • Check 9n9s rate limiting settings
    • Reduce alert frequency if needed
    • Use message grouping features
  2. Discord API Limits

    • Discord limits: 30 messages per minute
    • 9n9s automatically retries
    • Consider using multiple webhooks for high volume

Formatting Issues:

  1. Embed Not Displaying
    • Verify embed is enabled in Discord channel
    • Check JSON structure validity
    • Test with simplified embed first

Common Discord API errors:

  • 400 Bad Request: Invalid webhook payload
  • 401 Unauthorized: Invalid webhook URL
  • 404 Not Found: Webhook was deleted
  • 429 Too Many Requests: Rate limit exceeded

Test your Discord integration:

Terminal window
# Test webhook manually
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"content": "Test message from 9n9s",
"embeds": [{
"title": "Test Alert",
"description": "This is a test message",
"color": 3447003
}]
}' \
"YOUR_WEBHOOK_URL"
  1. Dedicated Channels

    • Create specific channels for monitoring alerts
    • Separate critical from informational alerts
    • Use clear channel names (#9n9s-alerts, #monitoring)
  2. Role Structure

    • Create monitoring-specific roles
    • Configure role permissions appropriately
    • Use role mentions strategically
  1. Clear Information

    • Include service name and environment
    • Provide direct links to dashboards
    • Use consistent formatting
  2. Actionable Content

    • Include troubleshooting links
    • Provide escalation procedures
    • Add relevant context and tags
  1. Regular Reviews

    • Test webhook functionality monthly
    • Review and update role mentions
    • Clean up unused webhooks
  2. Documentation

    • Document webhook purposes
    • Maintain channel guidelines
    • Keep emergency contact information updated

Discord integration provides an excellent way to keep your team informed about system health in a platform they’re already using. Configure multiple channels and role mentions to ensure the right people get notified about the right issues at the right time.