Skip to content

feat: send webhook notification after crawl (closes #15) - #56

Open
barunTayenjam wants to merge 3 commits into
StJudeWasHere:mainfrom
barunTayenjam:feat/crawl-notifications
Open

barunTayenjam wants to merge 3 commits into
StJudeWasHere:mainfrom
barunTayenjam:feat/crawl-notifications

Conversation

@barunTayenjam

Copy link
Copy Markdown

Summary

Sends a JSON webhook POST when a crawl finishes, so users can wire weekly monitors (e.g. this stacks on #55 scheduled crawls) to Slack/Discord/CI without adding provider SDKs.

Changes

  • DB: migration 0077 adds projects.webhook_url; repository persists/loads it.
  • WebhookService: Notify() POSTs JSON payload (project id/url, crawl id, scheduled flag, start/end, total/critical/alert/warning issue counts), 10s timeout, fail-soft (log only).
  • CrawlerService: notifies after crawl completes.
  • Project add/edit forms + validation (absolute http/https only).
  • Docs: README + INSTALL with example payload; i18n labels (en/es/nl/uk/fa).

Testing

  • Unit: TestWebhookURLs, TestNotifyPostsCrawlSummary (httptest), TestNotifySkipsEmptyURL; race suite green.
  • Manual e2e (Docker, MySQL 8.4): manual crawl delivered {"scheduled":false,...}; forced schedule delivered {"scheduled":true,...}; invalid scheme rejected.

Projects can now have a crawl schedule (hourly, daily or weekly),
selected when the project is created or edited. While the server is
running, a scheduler ticks every minute and starts a new crawl for
every scheduled project whose next run time has passed.

- migration 0076: projects.schedule_interval + projects.next_run
- models/repository: schedule fields, FindScheduledProjects,
  UpdateProjectNextRun
- SchedulerService with injected clock; next_run always advances
  (even on error) so a failing project never blocks the schedule;
  BasicAuth projects are skipped as their credentials are not stored
- SaveProject sets next_run; UpdateProject recomputes it only when
  the interval changes
- [scheduler] enabled config (SEONAUT_SCHEDULER_ENABLED), default on
- project add/edit forms: schedule select + validation error
- translations: schedule strings in en, es, nl, uk, fa
- docs: README + INSTALL.md (scheduled crawls section)

Verified end-to-end (MySQL 8.4 + local test site): manual crawl
produces report/CSV, forcing next_run past due triggers a scheduled
crawl within one tick and advances next_run, invalid interval is
rejected, restart causes no catch-up burst.
@barunTayenjam

Copy link
Copy Markdown
Author

Closing for now while I finish local verification of the stacked branch. Will reopen once tested. Sorry for the noise.

@barunTayenjam

Copy link
Copy Markdown
Author

Reopening after completing local end-to-end verification (scheduled + manual crawls both deliver correct webhook payloads). Also includes a small follow-up: schedule badge on the projects home page.

@barunTayenjam barunTayenjam reopened this Oct 9, 2026
@barunTayenjam
barunTayenjam force-pushed the feat/crawl-notifications branch from 1fcab26 to fbdce2c Compare October 10, 2026 15:00
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.

1 participant