Skip to content

Latest commit

 

History

History
128 lines (89 loc) · 2.75 KB

File metadata and controls

128 lines (89 loc) · 2.75 KB

Quick Guide: Get Your Slack Webhook URL

Method 1: Create New Slack App (Recommended)

Step-by-Step:

  1. Go to Slack API Dashboard

  2. Create New App

    • Click**"Create New App"** button
    • Select**"From scratch"**
    • App Name:Sentinel AIOps (or any name)
    • Pick Workspace: Select your workspace
    • Click**"Create App"**
  3. Enable Incoming Webhooks

    • In left sidebar, click**"Incoming Webhooks"**
    • Toggle**"Activate Incoming Webhooks"** toON
  4. Add Webhook to Workspace

    • Click**"Add New Webhook to Workspace"** button
    • Select Channel:#all-aitubby (or your preferred channel)
    • Click**"Allow"**
  5. Copy Webhook URL

    • You'll see a webhook URL like:
      https://hooks.slack.com
      
    • Click**"Copy"** button
  6. Save to .env

    # Run the setup script
    ./setup_slack_webhook.sh
    
    # OR manually add to .env
    echo "SENTINEL_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/URL" >> .env

Method 2: Use Existing Webhook (If You Have One)

If you already have a Slack webhook URL:

# Add directly to .env
echo "SENTINEL_SLACK_WEBHOOK_URL=YOUR_EXISTING_URL" >> .env

Method 3: Use Slack Workflow Builder (Alternative)

  1. Go to your Slack workspace
  2. Click**"Workflows"** in left sidebar
  3. Create new workflow
  4. Add**"Webhook"** trigger
  5. Copy the webhook URL provided

Verify Setup

After adding the webhook URL:

# Test the webhook
python test_webhook_slack.py

# Expected output:
# ✅ Slack webhook configured
# ✅ Sending test message...
# ✅ Message sent successfully!
# 💡 Check your Slack channel: #all-aitubby

Troubleshooting

"Invalid webhook URL"

  • Make sure URL starts withhttps://hooks.slack.com/services/
  • Check for typos or extra spaces
  • URL should be on a single line in.env

"Webhook not found"

  • Verify the webhook is still active in Slack
  • Check if the channel still exists
  • Re-create the webhook if needed

"Rate limit exceeded"

  • Slack allows 1 request/second per webhook
  • Wait a moment and try again
  • Checkconfig/sentinel.yaml for rate limit settings

Security Notes

⚠️ Important:

  • Never commit.env file to git (it's in.gitignore)
  • Webhook URLs are sensitive - treat like passwords
  • Rotate webhook URLs if compromised
  • Use different webhooks for dev/staging/prod

Quick Commands

# Setup webhook (interactive)
./setup_slack_webhook.sh

# Test webhook
python test_webhook_slack.py

# Check configuration
python -c "from config import get_config; print(get_config().webhooks.slack.webhook_url[:50] if get_config().webhooks.slack.webhook_url else 'Not configured')"