Skip to content

feat: Radarr/Sonarr webhooks for instant media availability#102

Closed
arediss wants to merge 1 commit intomainfrom
feat/webhooks-arr
Closed

feat: Radarr/Sonarr webhooks for instant media availability#102
arediss wants to merge 1 commit intomainfrom
feat/webhooks-arr

Conversation

@arediss
Copy link
Copy Markdown
Owner

@arediss arediss commented Apr 8, 2026

Summary

Instant media availability detection via Radarr/Sonarr webhooks. When a download completes, Oscarr is notified in real-time instead of waiting for the next sync (15+ min).

How it works

  • POST /api/webhooks/:serviceType — generic webhook endpoint
  • Provider-driven: each *arr provider implements parseWebhookPayload() on ArrClient
  • On Download event: media status → available, notifications sent immediately
  • Authentication: API key via Basic Auth password (Radarr/Sonarr native format), X-Api-Key header, or query param

Configuration

In Radarr/Sonarr → Settings → Connect → Webhook:

  • URL: http://<oscarr-host>:3456/api/webhooks/radarr (or /sonarr)
  • Password: Oscarr API key (from Admin > General)
  • Events: On Import

Architecture

  • ArrWebhookEvent interface in providers/types.ts
  • parseWebhookPayload() optional method on ArrClient
  • RadarrClient extracts tmdbId from webhook payload
  • SonarrClient extracts tvdbId + episode info
  • Core webhook handler is provider-agnostic — adding webhooks for Lidarr = implement parseWebhookPayload()

Closes #34

Test plan

  • Radarr test webhook → 200 + [Webhook] radarr test received
  • Sonarr test webhook → 200 + [Webhook] sonarr test received
  • Auth via Basic Auth password works
  • Invalid API key → 403
  • No API key → 401
  • Real download → media promoted to available + notifications sent

- ArrWebhookEvent interface + parseWebhookPayload() on ArrClient
- RadarrClient parses Download, Grab, Test events (extracts tmdbId)
- SonarrClient parses same + extracts tvdbId, seasonNumber, episodeNumber
- POST /api/webhooks/:serviceType — generic endpoint, auth via API key
  (X-Api-Key header, query param, or Basic Auth password for Radarr/Sonarr compat)
- On download event: promote media to available + send notifications instantly
- Test event returns 200 with confirmation message
- RBAC: /api/webhooks prefix is PUBLIC (auth handled in handler)

Configuration in Radarr/Sonarr:
  URL: http://<oscarr>/api/webhooks/radarr (or /sonarr)
  Password: Oscarr API key
  Events: On Import

Closes #34

// 3. Handle event
if (event.type === 'test') {
console.log(`[Webhook] ${serviceType} test received`);
}

if (!media) {
console.log(`[Webhook] ${serviceType} download event for unknown media: ${event.title} (${event.externalId})`);
media.tmdbId,
);
logEvent('info', 'Webhook', `"${event.title}" is now available (via ${serviceType} webhook)`);
console.log(`[Webhook] ${serviceType}: "${event.title}" → available`);
@arediss arediss closed this Apr 8, 2026
@arediss arediss deleted the feat/webhooks-arr branch April 8, 2026 21:45
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.

feat: Radarr/Sonarr webhooks for instant media availability notifications

2 participants