feat: Radarr/Sonarr webhooks for instant media availability#102
Closed
feat: Radarr/Sonarr webhooks for instant media availability#102
Conversation
- 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`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 endpointparseWebhookPayload()onArrClientDownloadevent: media status →available, notifications sent immediatelyConfiguration
In Radarr/Sonarr → Settings → Connect → Webhook:
http://<oscarr-host>:3456/api/webhooks/radarr(or/sonarr)Architecture
ArrWebhookEventinterface inproviders/types.tsparseWebhookPayload()optional method onArrClienttmdbIdfrom webhook payloadtvdbId+ episode infoparseWebhookPayload()Closes #34
Test plan
[Webhook] radarr test received[Webhook] sonarr test received