Skip to content

Conversation

BreizhHardware
Copy link

This pull request introduces a webhook management system that includes creating, scheduling, and triggering webhooks, along with a new API for managing them. Key changes include the addition of a WebhookManager class, a WebhookScheduler class, a new database table for webhooks, and corresponding API routes.

Webhook Management System

  • WebhookManager Class:

    • Implements core functionality for managing and triggering webhooks, including methods for event-based and scheduled webhooks, template compilation, and monthly summary generation.
  • WebhookScheduler Class:

    • Handles the scheduling of webhooks using cron jobs, allowing periodic execution of scheduled webhooks.

Database and API Enhancements

  • Database Migration:

    • Adds a new webhooks table to store webhook configurations, including fields for name, URL, headers, payload, trigger type, schedule, and more.
  • API Routes for Webhooks:

    • Introduces CRUD operations for webhooks (GET, POST, PUT, DELETE), along with endpoints to test and trigger monthly summary webhooks.

Integration and Dependencies

  • Server Integration:

    • Registers the webhook routes and initializes the WebhookScheduler in the server setup. [1] [2] [3]
  • New Dependency:

    • Adds node-cron for scheduling webhook tasks.

    Used to complete Webhooks? #6

@BreizhHardware
Copy link
Author

Att the moment I only have created the web ui for the monthly report but the code support all type of webhook (daily with custom information or on event)

@BreizhHardware BreizhHardware changed the base branch from main to unstable April 25, 2025 12:31
@CyferShepard
Copy link
Owner

hey @BreizhHardware . Just tested this out. theres an error when running.

[WEBHOOK] Failed to load scheduled webhooks: TypeError: Cannot read properties of undefined (reading 'forEach') at WebhookScheduler.loadScheduledWebhooks (F:\Documents\react\Jellystat-unstable-live\backend\classes\webhook-scheduler.js:21:22) at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Think on new instnaces, when the db returns 0 rows for getScheduledWebhooks() causes this error

@BreizhHardware
Copy link
Author

It should be fixed now (and I have removed all the french debug things that I had left)

…s refreshed on interval

increase refresh interval to 10 seconds
removed redundat empty webhooks message and check
@CyferShepard
Copy link
Owner

so far looks good. il check again once everything is completed. I added a few quick QOL changes

@BreizhHardware
Copy link
Author

Hi, I come back to you after a while (I was pretty busy), I have a question, for which event do you find relevant to send a notification using a webhook ? I was thinking when a new media is discovered and when a session start, but do you have any other idea ?

BreizhHardware and others added 7 commits May 23, 2025 08:29
- Implement event handlers for 'playback_started', 'playback_ended' and 'media_recently_added'
- Add API routes to manage event webhook status
- Create user interface components for easy webhook configuration
- Update webhook manager to properly trigger events
- Add translations for new UI elements
@BreizhHardware
Copy link
Author

Hi, I have add event based webhook and generic webhook support.

@CyferShepard
Copy link
Owner

Hey @BreizhHardware , sorry for taking so long to get back to this, il get to reviewing it over the next few days and provide any feedback if any

@CyferShepard
Copy link
Owner

Hey @BreizhHardware , everything seems good, im going to merge this into unstable for now and work on adding more ui elements later for the different hook types. The base functionality seems good so far and dont want anything to break due to merge conflicts

@CyferShepard CyferShepard merged commit 8177cfb into CyferShepard:unstable Oct 5, 2025
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.

2 participants