Skip to content

feat: add webhook notification system for Slack, Discord, and email a… - #133

Open
Shikhar-404exe wants to merge 3 commits into
sharmavaibhav31:mainfrom
Shikhar-404exe:feat/webhook-notification-system
Open

feat: add webhook notification system for Slack, Discord, and email a…#133
Shikhar-404exe wants to merge 3 commits into
sharmavaibhav31:mainfrom
Shikhar-404exe:feat/webhook-notification-system

Conversation

@Shikhar-404exe

Copy link
Copy Markdown

Description

Implements a modular webhook notification system that pushes real-time alerts to Slack, Discord, and Email when automation events occur. Closes #74.

Event Types Notified

Event Trigger Severity
jobs:new New matching jobs found during scrape cycle success
contacts:found New contacts discovered success
emails:drafted Cold emails pre-generated success
scrape:error Cycle completed with errors / unhandled exception error
cycle:complete Cycle finished with no new items info

Architecture — Modular Provider System

notifier.dispatch() ← fire-and-forget, never propagates exceptions ├── SlackProvider (slack.py) ← Incoming Webhooks, blocks layout ├── DiscordProvider (discord.py) ← Webhook embeds, color-coded └── EmailProvider (email.py) ← Gmail SMTP (reuses existing mailer pattern)

Adding a new channel = subclass NotificationProvider + register with notifier.register().

Admin Requirements Addressed

  1. Isolated delivery — all provider calls wrapped in try/except; failures never interrupt scheduler cycles
  2. Rate limiting — per-event-type cooldown (default 300s, configurable via NOTIFY_RATE_LIMIT_SECS)
  3. Reused email infraEmailProvider uses the same smtplib.SMTP_SSL / Gmail App Password pattern as email-generator-service/mailer.py
  4. Modular providers — abstract base class, one file per provider, auto-registered from env vars on import

New Files (6)

File Purpose
scheduler/notifier.py Central dispatcher, rate limiter, sync/async wrappers
scheduler/providers/base.py NotificationProvider ABC + NotificationEvent dataclass
scheduler/providers/slack.py Slack webhook with rich blocks
scheduler/providers/discord.py Discord webhook with embedded messages
scheduler/providers/email.py Email via Gmail SMTP

Modified Files (6)

File Changes
scheduler/tasks.py Fires notifications after scrape/discover/draft cycles
scheduler/main.py Loads NOTIFY_EVENTS filter; fires error notifications on failures
gateway/main.py GET/PUT /api/notifications/config, POST /api/notifications/test
gateway/dashboard.html ⚙ Settings tab with URL inputs, event toggles, rate limit, test buttons
docker-compose.yml 5 new env vars on scheduler + gateway
scheduler/README.md Documents all new env vars

Dashboard — Settings Tab

  • Slack / Discord Webhook URL inputs
  • Notification Email field
  • Event type checkboxes — toggle which events trigger alerts
  • Rate limit control (seconds)
  • Test buttons per channel — sends a sample notification to verify config
  • Save button — persists config to shared Docker volume (/data/notify_config.json)

Environment Variables (all optional — notifications are no-ops when unset)

Variable Default Description
SLACK_WEBHOOK_URL Slack Incoming Webhook URL
DISCORD_WEBHOOK_URL Discord Webhook URL
NOTIFICATION_EMAIL Recipient for email notifications
NOTIFY_RATE_LIMIT_SECS 300 Cooldown window per event type
NOTIFY_EVENTS all Comma-separated enabled event types

Testing

  1. Set SLACK_WEBHOOK_URL or DISCORD_WEBHOOK_URL in .env or docker-compose override
  2. Restart scheduler: docker compose up -d scheduler
  3. Open dashboard → ⚙ Settings → enter webhook URL → click Test Slack / Test Discord
  4. Wait for next scrape cycle or trigger manually: MANUAL_TASK=scrape docker compose run --rm scheduler

…lerts

- Add modular provider system (Slack/Discord/Email) with abstract base class
- Implement fire-and-forget dispatch isolated from core scheduler flow
- Add per-event-type rate limiting (default 300s window)
- Fire notifications after scrape/discover/draft cycles:
  jobs:new, contacts:found, emails:drafted, scrape:error, cycle:complete
- Add Gateway REST endpoints:
  GET/PUT /api/notifications/config, POST /api/notifications/test
- Add Settings tab to dashboard with webhook URL inputs,
  event-type checkboxes, and test buttons for each channel
- Reuse existing Gmail SMTP infrastructure for email notifications
- Document new env vars and add to docker-compose.yml
…structure

- Remove duplicate btn-scrape and btn-export-csv elements
- Fix misplaced nav-right div (was outside <nav> tag)
- Fix stray closing </nav> tags
- Remove duplicate event listeners for scrape modal
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

@Shikhar-404exe is attempting to deploy a commit to the Vaibhav Sharma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Webhook Notification System for Real-Time Job & Discovery Alerts

1 participant